mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-08-25 13:49:40 +00:00
31 lines
937 B
TypeScript
31 lines
937 B
TypeScript
import { ApiProperty } from '@nestjs/swagger';
|
|
import { ILoginResponse } from '~/auth/interfaces';
|
|
import { CustomerResponseDto } from '~/customer/dtos/response';
|
|
import { User } from '~/user/entities';
|
|
import { UserResponseDto } from './user.response.dto';
|
|
|
|
export class LoginResponseDto {
|
|
@ApiProperty()
|
|
accessToken!: string;
|
|
|
|
@ApiProperty()
|
|
refreshToken!: string;
|
|
|
|
@ApiProperty()
|
|
expiresAt!: Date;
|
|
|
|
@ApiProperty({ example: UserResponseDto })
|
|
user!: UserResponseDto;
|
|
|
|
@ApiProperty({ type: CustomerResponseDto })
|
|
customer!: CustomerResponseDto | null;
|
|
|
|
constructor(IVerifyUserResponse: ILoginResponse, user: User) {
|
|
this.user = new UserResponseDto(user);
|
|
this.customer = user.customer ? new CustomerResponseDto(user.customer) : null;
|
|
this.accessToken = IVerifyUserResponse.accessToken;
|
|
this.refreshToken = IVerifyUserResponse.refreshToken;
|
|
this.expiresAt = IVerifyUserResponse.expiresAt;
|
|
}
|
|
}
|