131caa20eb
* refactor: user repository * refactor: user module * refactor: move database into infra * refactor(cli): use user core * chore: import path * chore: tests
42 lines
920 B
TypeScript
42 lines
920 B
TypeScript
import { UserEntity } from '@app/infra';
|
|
import { ApiResponseProperty } from '@nestjs/swagger';
|
|
|
|
export class LoginResponseDto {
|
|
@ApiResponseProperty()
|
|
accessToken!: string;
|
|
|
|
@ApiResponseProperty()
|
|
userId!: string;
|
|
|
|
@ApiResponseProperty()
|
|
userEmail!: string;
|
|
|
|
@ApiResponseProperty()
|
|
firstName!: string;
|
|
|
|
@ApiResponseProperty()
|
|
lastName!: string;
|
|
|
|
@ApiResponseProperty()
|
|
profileImagePath!: string;
|
|
|
|
@ApiResponseProperty()
|
|
isAdmin!: boolean;
|
|
|
|
@ApiResponseProperty()
|
|
shouldChangePassword!: boolean;
|
|
}
|
|
|
|
export function mapLoginResponse(entity: UserEntity, accessToken: string): LoginResponseDto {
|
|
return {
|
|
accessToken: accessToken,
|
|
userId: entity.id,
|
|
userEmail: entity.email,
|
|
firstName: entity.firstName,
|
|
lastName: entity.lastName,
|
|
isAdmin: entity.isAdmin,
|
|
profileImagePath: entity.profileImagePath,
|
|
shouldChangePassword: entity.shouldChangePassword,
|
|
};
|
|
}
|