@appsemble/node-utils
Version:
NodeJS utilities used by Appsemble internally.
17 lines • 781 B
JavaScript
import { assertKoaCondition } from '../../../../../koa.js';
import { deleteResourcesRecursively } from '../../../../utils/resources.js';
export function createDeleteAppSeedResourcesController(options) {
return async (ctx) => {
const { pathParams: { appId }, } = ctx;
const { getApp } = options;
const app = await getApp({
context: ctx,
query: { attributes: ['id', 'definition'], where: { id: appId } },
});
assertKoaCondition(app != null, ctx, 404, 'App not found');
for (const resourceType of Object.keys(app.definition.resources ?? {})) {
await deleteResourcesRecursively(resourceType, app, options, ctx);
}
};
}
//# sourceMappingURL=createDeleteAppSeedResourcesController.js.map