@lucidcms/core
Version:
The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.
1 lines • 1.19 kB
Source Map (JSON)
{"version":3,"file":"clear-expired-auth-states.mjs","names":[],"sources":["../../../src/services/crons/clear-expired-auth-states.ts"],"sourcesContent":["import { AuthStatesRepository } from \"../../libs/repositories/index.js\";\nimport type { ServiceFn } from \"../../utils/services/types.js\";\n\n/**\n * Deletes expired auth state rows.\n */\nconst clearExpiredAuthStates: ServiceFn<[], undefined> = async (context) => {\n\tconst AuthStates = new AuthStatesRepository(\n\t\tcontext.db.client,\n\t\tcontext.config.db,\n\t);\n\tconst now = new Date().toISOString();\n\n\tconst clearRes = await AuthStates.deleteMultiple({\n\t\twhere: [\n\t\t\t{\n\t\t\t\tkey: \"expiry_date\",\n\t\t\t\toperator: \"<\",\n\t\t\t\tvalue: now,\n\t\t\t},\n\t\t],\n\t});\n\tif (clearRes.error) return clearRes;\n\n\treturn {\n\t\terror: undefined,\n\t\tdata: undefined,\n\t};\n};\n\nexport default clearExpiredAuthStates;\n"],"mappings":"uDAMA,MAAM,EAAmD,KAAO,IAAY,CAC3E,IAAM,EAAa,IAAI,EACtB,EAAQ,GAAG,OACX,EAAQ,OAAO,EAChB,EACM,EAAM,IAAI,KAAK,CAAA,CAAE,YAAY,EAE7B,EAAW,MAAM,EAAW,eAAe,CAChD,MAAO,CACN,CACC,IAAK,cACL,SAAU,IACV,MAAO,CACR,CACD,CACD,CAAC,EAGD,OAFI,EAAS,MAAc,EAEpB,CACN,MAAO,IAAA,GACP,KAAM,IAAA,EACP,CACD"}