This repository has been archived on 2025-03-21. You can view files and clone it, but cannot push or open issues or pull requests.
insiemesalute-3p-nx/apps/ebitemp-api/src/modules/auth/auth.dto.ts

20 lines
711 B
TypeScript

import { createZodDto } from '@anatine/zod-nestjs';
import { z } from 'zod';
import { AccountsEntitySchema } from '../database/connections/ebitemp-api/entities';
export const loginSchema = z.object({
username: AccountsEntitySchema.shape.username,
password: z.string().nonempty(),
});
export type Login = z.infer<typeof loginSchema>;
export class LoginDto extends createZodDto(loginSchema) {}
export const loginResSchema = z.object({
accessToken: z.string().jwt(),
accessTokenExp: z.string().datetime(),
refreshToken: z.string().jwt(),
refreshTokenExp: z.string().datetime()
})
export type LoginRes = z.infer<typeof loginResSchema>;
export class LoginResDto extends createZodDto(loginResSchema) {}