@lucidcms/core
Version:
The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.
1 lines • 2.02 kB
Source Map (JSON)
{"version":3,"file":"get-single.mjs","names":["jobsFormatter"],"sources":["../../../src/services/jobs/get-single.ts"],"sourcesContent":["import { jobsFormatter } from \"../../libs/formatters/index.js\";\nimport { copy } from \"../../libs/i18n/index.js\";\nimport { QueueJobsRepository } from \"../../libs/repositories/index.js\";\nimport type { Job } from \"../../types/response.js\";\nimport type { ServiceFn } from \"../../utils/services/types.js\";\n\nconst getSingle: ServiceFn<\n\t[\n\t\t{\n\t\t\tid: number;\n\t\t},\n\t],\n\tJob\n> = async (context, data) => {\n\tconst Jobs = new QueueJobsRepository(context.db.client, context.config.db);\n\n\tconst jobRes = await Jobs.selectSingleById({\n\t\tselect: [\n\t\t\t\"id\",\n\t\t\t\"job_id\",\n\t\t\t\"event_type\",\n\t\t\t\"event_data\",\n\t\t\t\"queue_adapter_key\",\n\t\t\t\"status\",\n\t\t\t\"priority\",\n\t\t\t\"attempts\",\n\t\t\t\"max_attempts\",\n\t\t\t\"error_message\",\n\t\t\t\"created_at\",\n\t\t\t\"scheduled_for\",\n\t\t\t\"started_at\",\n\t\t\t\"completed_at\",\n\t\t\t\"failed_at\",\n\t\t\t\"next_retry_at\",\n\t\t\t\"created_by_user_id\",\n\t\t\t\"updated_at\",\n\t\t],\n\t\tid: data.id,\n\t\ttenantKey: context.request.tenantKey,\n\t\tvalidation: {\n\t\t\tenabled: true,\n\t\t\tdefaultError: {\n\t\t\t\tmessage: copy(\"server:core.job.not.found.message\"),\n\t\t\t\tstatus: 404,\n\t\t\t},\n\t\t},\n\t});\n\tif (jobRes.error) return jobRes;\n\n\treturn {\n\t\terror: undefined,\n\t\tdata: jobsFormatter.formatSingle({\n\t\t\tjob: jobRes.data,\n\t\t}),\n\t};\n};\n\nexport default getSingle;\n"],"mappings":"oJAMA,MAAM,EAOF,MAAO,EAAS,IAAS,CAG5B,IAAM,EAAS,MAAM,IAFJ,EAAoB,EAAQ,GAAG,OAAQ,EAAQ,OAAO,EAE/C,CAAC,CAAC,iBAAiB,CAC1C,OAAQ,CACP,KACA,SACA,aACA,aACA,oBACA,SACA,WACA,WACA,eACA,gBACA,aACA,gBACA,aACA,eACA,YACA,gBACA,qBACA,YACD,EACA,GAAI,EAAK,GACT,UAAW,EAAQ,QAAQ,UAC3B,WAAY,CACX,QAAS,GACT,aAAc,CACb,QAAS,EAAK,mCAAmC,EACjD,OAAQ,GACT,CACD,CACD,CAAC,EAGD,OAFI,EAAO,MAAc,EAElB,CACN,MAAO,IAAA,GACP,KAAMA,EAAc,aAAa,CAChC,IAAK,EAAO,IACb,CAAC,CACF,CACD"}