UNPKG

@topgroup/diginext

Version:

A BUILD SERVER & CLI to deploy apps to any Kubernetes clusters.

31 lines (30 loc) 1.43 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.deletePermanentSoftDeletedItemsAllCollections = void 0; const entities_1 = require("../entities"); const services_1 = require("../services"); async function deletePermanentDeletedItemsInCollection(schema) { const svc = new services_1.BaseService(schema); // const items = await svc.find({ deletedAt: { $exists: true } }); // console.log("count :>> ", items.length); // console.log("items :>> ", items); // return items; const res = await svc.delete({ deletedAt: { $exists: true } }); console.log(`deletePermanentDeletedItemsInCollection :>> `, res.affected); return res; } async function deletePermanentSoftDeletedItemsAllCollections() { // apps await deletePermanentDeletedItemsInCollection(entities_1.appSchema); // projects await deletePermanentDeletedItemsInCollection(entities_1.projectSchema); // builds await deletePermanentDeletedItemsInCollection(entities_1.buildSchema); // registry await deletePermanentDeletedItemsInCollection(entities_1.containerRegistrySchema); // cluster await deletePermanentDeletedItemsInCollection(entities_1.clusterSchema); // registry await deletePermanentDeletedItemsInCollection(entities_1.containerRegistrySchema); } exports.deletePermanentSoftDeletedItemsAllCollections = deletePermanentSoftDeletedItemsAllCollections;