37 lines
1.0 KiB
TypeScript
37 lines
1.0 KiB
TypeScript
import { ContactAggregate } from '../../../Domain/Contact/ContactAggregate';
|
|
import { CreateContactDto, UpdateContactDto, ShortContactDto, DetailContactDto } from '../ContactDto';
|
|
|
|
export class ContactMapper {
|
|
static toShortDto(contact: ContactAggregate): ShortContactDto {
|
|
return {
|
|
id: contact.id,
|
|
name: contact.name,
|
|
email: contact.email,
|
|
type: contact.type,
|
|
createDate: contact.createDate,
|
|
state: contact.state,
|
|
};
|
|
}
|
|
|
|
static toDetailDto(contact: ContactAggregate): DetailContactDto {
|
|
return {
|
|
id: contact.id,
|
|
name: contact.name,
|
|
email: contact.email,
|
|
userid: contact.userid,
|
|
type: contact.type,
|
|
txt: contact.txt,
|
|
state: contact.state,
|
|
createDate: contact.createDate,
|
|
updateDate: contact.updateDate,
|
|
adminResponse: contact.adminResponse,
|
|
responseDate: contact.responseDate,
|
|
respondedBy: contact.respondedBy,
|
|
};
|
|
}
|
|
|
|
static toShortDtoList(contacts: ContactAggregate[]): ShortContactDto[] {
|
|
return contacts.map(this.toShortDto);
|
|
}
|
|
}
|