UNPKG

@lucidcms/core

Version:

The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.

1 lines 1.41 kB
{"version":3,"file":"user-logins.mjs","names":["formatter"],"sources":["../../../src/libs/formatters/user-logins.ts"],"sourcesContent":["import type { UserLogin } from \"../../types/response.js\";\nimport formatter from \"./index.js\";\n\ninterface UserLoginPropT {\n\tid: number;\n\tuser_id: number | null;\n\ttoken_id: number | null;\n\tauth_method: string;\n\tip_address: string | null;\n\tuser_agent: string | null;\n\tcreated_at: Date | string | null;\n}\n\nconst formatMultiple = (props: { userLogins: UserLoginPropT[] }) => {\n\treturn props.userLogins.map((login) =>\n\t\tformatSingle({\n\t\t\tuserLogin: login,\n\t\t}),\n\t);\n};\n\nconst formatSingle = (props: { userLogin: UserLoginPropT }): UserLogin => {\n\treturn {\n\t\tid: props.userLogin.id,\n\t\tuserId: props.userLogin.user_id,\n\t\ttokenId: props.userLogin.token_id,\n\t\tauthMethod: props.userLogin.auth_method,\n\t\tipAddress: props.userLogin.ip_address,\n\t\tuserAgent: props.userLogin.user_agent,\n\t\tcreatedAt: formatter.formatDate(props.userLogin.created_at),\n\t};\n};\n\nexport default {\n\tformatMultiple,\n\tformatSingle,\n};\n"],"mappings":"2BAaA,MAAM,EAAkB,GAChB,EAAM,WAAW,IAAK,GAC5B,EAAa,CACZ,UAAW,CACZ,CAAC,CACF,EAGK,EAAgB,IACd,CACN,GAAI,EAAM,UAAU,GACpB,OAAQ,EAAM,UAAU,QACxB,QAAS,EAAM,UAAU,SACzB,WAAY,EAAM,UAAU,YAC5B,UAAW,EAAM,UAAU,WAC3B,UAAW,EAAM,UAAU,WAC3B,UAAWA,EAAU,WAAW,EAAM,UAAU,UAAU,CAC3D,GAGD,IAAA,EAAe,CACd,iBACA,cACD"}