forked from Sairyss/domain-driven-hexagon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuser.response.dto.ts
38 lines (33 loc) · 1021 Bytes
/
user.response.dto.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { UserEntity } from '@modules/user/domain/entities/user.entity';
import { ResponseBase } from 'src/interface-adapters/base-classes/response.base';
import { User } from 'src/interface-adapters/interfaces/user/user.interface';
import { ApiProperty } from '@nestjs/swagger';
export class UserResponse extends ResponseBase implements User {
constructor(user: UserEntity) {
super(user);
this.email = user.email.value;
this.country = user.address.country;
this.postalCode = user.address.postalCode;
this.street = user.address.postalCode;
}
@ApiProperty({
example: '[email protected]',
description: "User's email address",
})
email: string;
@ApiProperty({
example: 'France',
description: "User's country of residence",
})
country: string;
@ApiProperty({
example: '123456',
description: 'Postal code',
})
postalCode: string;
@ApiProperty({
example: 'Park Avenue',
description: 'Street where the user is registered',
})
street: string;
}