UNPKG

@mee4dy/crud

Version:

Create a backend and frontend in 5 minutes! With our powerful full stack crud system, customize it to suit you.

1 lines 946 B
{"version":3,"file":"use-crud-scope.decorator.cjs","sources":["../../../nestjs/decorators/use-crud-scope.decorator.ts"],"sourcesContent":["import { applyDecorators } from '@nestjs/common';\nimport { UseMiddleware } from './use-middleware.decorator';\n\nexport const UseCrudScope = (callback) => {\n const middlewareDecorator = UseMiddleware((req) => {\n const crudScope = callback(req);\n\n if (!req.crudCtx) {\n req.crudCtx = {};\n }\n\n req.crudCtx.params = {\n ...req.crudCtx.params,\n ...crudScope,\n };\n });\n\n return applyDecorators(middlewareDecorator);\n};\n"],"names":["UseCrudScope","callback","middlewareDecorator","UseMiddleware","req","crudScope","applyDecorators"],"mappings":"8JAGaA,EAAgBC,GAAa,CAClC,MAAAC,EAAsBC,gBAAeC,GAAQ,CAC3C,MAAAC,EAAYJ,EAASG,CAAG,EAEzBA,EAAI,UACPA,EAAI,QAAU,CAAC,GAGjBA,EAAI,QAAQ,OAAS,CACnB,GAAGA,EAAI,QAAQ,OACf,GAAGC,CACL,CAAA,CACD,EAED,OAAOC,EAAAA,gBAAgBJ,CAAmB,CAC5C"}