{"version":3,"file":"get-single.mjs","names":["rolesFormatter"],"sources":["../../../src/services/roles/get-single.ts"],"sourcesContent":["import { rolesFormatter } from \"../../libs/formatters/index.js\";\nimport { copy } from \"../../libs/i18n/index.js\";\nimport { RolesRepository } from \"../../libs/repositories/index.js\";\nimport type { Role } 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\tRole\n> = async (context, data) => {\n\tconst Roles = new RolesRepository(context.db.client, context.config.db);\n\n\tconst roleRes = await Roles.selectSingleById({\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.roles.not.found.message\"),\n\t\t\t\tstatus: 404,\n\t\t\t},\n\t\t},\n\t});\n\tif (roleRes.error) return roleRes;\n\n\treturn {\n\t\terror: undefined,\n\t\tdata: rolesFormatter.formatSingle({\n\t\t\trole: roleRes.data,\n\t\t}),\n\t};\n};\n\nexport default getSingle;\n"],"mappings":"gJAMA,MAAM,EAOF,MAAO,EAAS,IAAS,CAG5B,IAAM,EAAU,MAAM,IAFJ,EAAgB,EAAQ,GAAG,OAAQ,EAAQ,OAAO,EAE1C,CAAC,CAAC,iBAAiB,CAC5C,GAAI,EAAK,GACT,UAAW,EAAQ,QAAQ,UAC3B,WAAY,CACX,QAAS,GACT,aAAc,CACb,QAAS,EAAK,qCAAqC,EACnD,OAAQ,GACT,CACD,CACD,CAAC,EAGD,OAFI,EAAQ,MAAc,EAEnB,CACN,MAAO,IAAA,GACP,KAAMA,EAAe,aAAa,CACjC,KAAM,EAAQ,IACf,CAAC,CACF,CACD"}