feat: messages controller. (#653)

Co-authored-by: Mo <[email protected]>
This commit is contained in:
Karol Sójko
2023-07-10 14:21:59 +02:00
committed by GitHub
co-authored by Mo
parent cbc024f67a
commit 18d07d431f
5 changed files with 236 additions and 1 deletions
@@ -0,0 +1,21 @@
import { MapperInterface } from '@standardnotes/domain-core'
import { Message } from '../../Domain/Message/Message'
import { MessageHttpRepresentation } from './MessageHttpRepresentation'
export class MessageHttpMapper implements MapperInterface<Message, MessageHttpRepresentation> {
toDomain(_projection: MessageHttpRepresentation): Message {
throw new Error('Mapping from http representation to domain is not implemented.')
}
toProjection(domain: Message): MessageHttpRepresentation {
return {
uuid: domain.id.toString(),
recipient_uuid: domain.props.recipientUuid.value,
sender_uuid: domain.props.senderUuid.value,
encrypted_message: domain.props.encryptedMessage,
created_at_timestamp: domain.props.timestamps.createdAt,
updated_at_timestamp: domain.props.timestamps.updatedAt,
}
}
}