20 lines
711 B
TypeScript
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) {}
|