@lucidcms/core
Version:
The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.
1 lines • 2.82 kB
Source Map (JSON)
{"version":3,"file":"get-reviewers.mjs","names":["documentPublishOperationServices.getReviewers"],"sources":["../../../../../src/libs/http/controllers/publish-operations/get-reviewers.ts"],"sourcesContent":["import { createFactory } from \"hono/factory\";\nimport { describeRoute } from \"hono-openapi\";\nimport z from \"zod\";\nimport { controllerSchemas } from \"../../../../schemas/publish-operation-management.js\";\nimport { documentPublishOperationServices } from \"../../../../services/index.js\";\nimport { LucidAPIError } from \"../../../../utils/errors/index.js\";\nimport serviceWrapper from \"../../../../utils/services/service-wrapper.js\";\nimport authenticate from \"../../middleware/authenticate.js\";\nimport validate from \"../../middleware/validate.js\";\nimport openAPI from \"../../openapi/index.js\";\nimport formatAPIResponse from \"../../utils/build-response.js\";\nimport createServiceContext from \"../../utils/create-service-context.js\";\n\nconst factory = createFactory();\n\nconst getReviewersController = factory.createHandlers(\n\tdescribeRoute({\n\t\tdescription: \"Get users who can review a publish operation target.\",\n\t\ttags: [\"publish-operations\"],\n\t\tsummary: \"Get Publish Operation Reviewers\",\n\t\tresponses: openAPI.responses({\n\t\t\tschema: z.toJSONSchema(controllerSchemas.getReviewers.response),\n\t\t}),\n\t\tparameters: openAPI.parameters({\n\t\t\tquery: controllerSchemas.getReviewers.query.string,\n\t\t}),\n\t}),\n\tauthenticate(),\n\tvalidate(\"query\", controllerSchemas.getReviewers.query.string),\n\tasync (c) => {\n\t\tconst query = c.req.valid(\"query\");\n\t\tconst context = createServiceContext(c);\n\n\t\tconst reviewers = await serviceWrapper(\n\t\t\tdocumentPublishOperationServices.getReviewers,\n\t\t\t{\n\t\t\t\ttransaction: false,\n\t\t\t},\n\t\t)(context, {\n\t\t\tcollectionKey: query.collectionKey,\n\t\t\ttarget: query.target,\n\t\t\tuser: c.get(\"auth\"),\n\t\t});\n\t\tif (reviewers.error) throw new LucidAPIError(reviewers.error);\n\n\t\tc.status(200);\n\t\treturn c.json(\n\t\t\tformatAPIResponse(c, {\n\t\t\t\tdata: reviewers.data,\n\t\t\t}),\n\t\t);\n\t},\n);\n\nexport default getReviewersController;\n"],"mappings":"2nBAeA,MAAM,EAFU,EAEqB,CAAC,CAAC,eACtC,EAAc,CACb,YAAa,uDACb,KAAM,CAAC,oBAAoB,EAC3B,QAAS,kCACT,UAAW,EAAQ,UAAU,CAC5B,OAAQ,EAAE,aAAa,EAAkB,aAAa,QAAQ,CAC/D,CAAC,EACD,WAAY,EAAQ,WAAW,CAC9B,MAAO,EAAkB,aAAa,MAAM,MAC7C,CAAC,CACF,CAAC,EACD,EAAa,EACb,EAAS,QAAS,EAAkB,aAAa,MAAM,MAAM,EAC7D,KAAO,IAAM,CACZ,IAAM,EAAQ,EAAE,IAAI,MAAM,OAAO,EAC3B,EAAU,EAAqB,CAAC,EAEhC,EAAY,MAAM,EACvBA,EACA,CACC,YAAa,EACd,CACD,CAAC,CAAC,EAAS,CACV,cAAe,EAAM,cACrB,OAAQ,EAAM,OACd,KAAM,EAAE,IAAI,MAAM,CACnB,CAAC,EACD,GAAI,EAAU,MAAO,MAAM,IAAI,EAAc,EAAU,KAAK,EAG5D,OADA,EAAE,OAAO,GAAG,EACL,EAAE,KACR,EAAkB,EAAG,CACpB,KAAM,EAAU,IACjB,CAAC,CACF,CACD,CACD"}