mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
import { MessageInputDTO } from "../../data/dto/message/messageInputDtO";
|
|
import { MessageOutPutDataDTO } from "../../data/dto/message/messageOutputDTO";
|
|
import { MessageEntity } from "../entity/message";
|
|
import { attachments } from '../../../../../../../../../Downloads/equilibriumito-gabinete-digital-fo-23cf0fc4cbaa/equilibriumito-gabinete-digital-fo-23cf0fc4cbaa/src/app/models/beast-orm';
|
|
|
|
export class MessageMapper {
|
|
static toDomain(DTO: MessageOutPutDataDTO) : MessageEntity {
|
|
return DTO as MessageEntity
|
|
}
|
|
|
|
static fromDomain(entity:MessageEntity, requestId): MessageInputDTO {
|
|
return {
|
|
canEdit: entity.canEdit,
|
|
message: entity.message,
|
|
messageType: entity.messageType,
|
|
oneShot: entity.oneShot,
|
|
requireUnlock: entity.requireUnlock,
|
|
roomId: entity.roomId,
|
|
senderId: entity.sender.wxUserId,
|
|
requestId: requestId,
|
|
attachment: entity.attachments.map((e)=>({
|
|
fileType:e.fileType,
|
|
source: e.source,
|
|
file: e.file,
|
|
fileName: e.fileName,
|
|
applicationId: e.applicationId || 0,
|
|
docId: Number(e.docId) || 0,
|
|
mimeType: e.mimeType
|
|
}))[0]
|
|
|
|
}
|
|
}
|
|
}
|