@lucidcms/core
Version:
The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.
2 lines • 515 B
JavaScript
import e from"../../libs/repositories/user-tokens.mjs";import t from"../../utils/helpers/hash-user-token.mjs";import n from"node:crypto";const r=async(r,i)=>{let a=new e(r.db.client,r.config.db),o=n.randomBytes(32).toString(`hex`),s=t(o),c=await a.createSingle({data:{user_id:i.userId,token_type:i.tokenType,expiry_date:i.expiryDate,token:s},returning:[`id`],validation:{enabled:!0}});return c.error?c:{error:void 0,data:{token:o,tokenId:c.data.id}}};export{r as default};
//# sourceMappingURL=create-single.mjs.map