mongodb-dynamic-api
Version:
Auto generated CRUD API for MongoDB using NestJS
37 lines • 1.43 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDefaultRouteDescription = void 0;
const lodash_1 = require("lodash");
function getDefaultRouteDescription(routeType, entityName) {
const contentName = (0, lodash_1.lowerCase)(entityName);
switch (routeType) {
case 'CreateMany':
return `Create many ${contentName}`;
case 'CreateOne':
return `Create one ${contentName}`;
case 'DeleteMany':
return `Delete many ${contentName}`;
case 'DeleteOne':
return `Delete one ${contentName}`;
case 'DuplicateMany':
return `Duplicate many ${contentName}`;
case 'DuplicateOne':
return `Duplicate one ${contentName}`;
case 'GetMany':
return `Get many ${contentName}`;
case 'GetOne':
return `Get one ${contentName} by id`;
case 'ReplaceOne':
return `Replace one ${contentName}`;
case 'UpdateMany':
return `Update many ${contentName}`;
case 'UpdateOne':
return `Update one ${contentName}`;
case 'Aggregate':
return `Get aggregated ${contentName}`;
default:
throw new Error(`Route type "${routeType}" is not supported`);
}
}
exports.getDefaultRouteDescription = getDefaultRouteDescription;
//# sourceMappingURL=route-description.helper.js.map