@appsemble/node-utils
Version:
NodeJS utilities used by Appsemble internally.
14 lines • 714 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: { 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