{"version":3,"file":"delete-single.mjs","names":[],"sources":["../../../../src/services/locales/jobs/delete-single.ts"],"sourcesContent":["import cacheKeys from \"../../../libs/kv/cache-keys.js\";\nimport { LocalesRepository } from \"../../../libs/repositories/index.js\";\nimport type { ServiceFn } from \"../../../utils/services/types.js\";\n\n/**\n * Deletes a single locale\n */\nconst deleteLocale: ServiceFn<\n\t[\n\t\t{\n\t\t\tlocaleCode: string;\n\t\t},\n\t],\n\tundefined\n> = async (context, data) => {\n\tconst Locales = new LocalesRepository(context.db.client, context.config.db);\n\n\tconst deleteRes = await Locales.deleteSingle({\n\t\twhere: [\n\t\t\t{\n\t\t\t\tkey: \"code\",\n\t\t\t\toperator: \"=\",\n\t\t\t\tvalue: data.localeCode,\n\t\t\t},\n\t\t],\n\t\treturning: [\"code\"],\n\t\tvalidation: {\n\t\t\tenabled: true,\n\t\t},\n\t});\n\tif (deleteRes.error) return deleteRes;\n\n\tawait context.kv.delete(context, {\n\t\tkey: cacheKeys.http.static.clientLocales,\n\t\thash: true,\n\t});\n\n\treturn {\n\t\terror: undefined,\n\t\tdata: undefined,\n\t};\n};\n\nexport default deleteLocale;\n"],"mappings":"qGAOA,MAAM,EAOF,MAAO,EAAS,IAAS,CAG5B,IAAM,EAAY,MAAM,IAFJ,EAAkB,EAAQ,GAAG,OAAQ,EAAQ,OAAO,EAE1C,CAAC,CAAC,aAAa,CAC5C,MAAO,CACN,CACC,IAAK,OACL,SAAU,IACV,MAAO,EAAK,UACb,CACD,EACA,UAAW,CAAC,MAAM,EAClB,WAAY,CACX,QAAS,EACV,CACD,CAAC,EAQD,OAPI,EAAU,MAAc,GAE5B,MAAM,EAAQ,GAAG,OAAO,EAAS,CAChC,IAAK,EAAU,KAAK,OAAO,cAC3B,KAAM,EACP,CAAC,EAEM,CACN,MAAO,IAAA,GACP,KAAM,IAAA,EACP,EACD"}