mirror of
https://github.com/standardnotes/server
synced 2026-07-14 00:01:54 -04:00
46 lines
1.2 KiB
TypeScript
46 lines
1.2 KiB
TypeScript
import { MapperInterface, SyncUseCaseInterface } from '@standardnotes/domain-core'
|
|
|
|
import { RevisionMetadata } from '../Domain/Revision/RevisionMetadata'
|
|
|
|
export class RevisionMetadataHttpMapper
|
|
implements
|
|
MapperInterface<
|
|
RevisionMetadata,
|
|
{
|
|
uuid: string
|
|
content_type: string
|
|
created_at: string
|
|
updated_at: string
|
|
required_role: string
|
|
}
|
|
>
|
|
{
|
|
constructor(private getRequiredRoleToViewRevision: SyncUseCaseInterface<string>) {}
|
|
|
|
toDomain(_projection: {
|
|
uuid: string
|
|
content_type: string
|
|
created_at: string
|
|
updated_at: string
|
|
required_role: string
|
|
}): RevisionMetadata {
|
|
throw new Error('Method not implemented.')
|
|
}
|
|
|
|
toProjection(domain: RevisionMetadata): {
|
|
uuid: string
|
|
content_type: string
|
|
created_at: string
|
|
updated_at: string
|
|
required_role: string
|
|
} {
|
|
return {
|
|
uuid: domain.id.toString(),
|
|
content_type: domain.props.contentType.value as string,
|
|
created_at: domain.props.dates.createdAt.toISOString(),
|
|
updated_at: domain.props.dates.updatedAt.toISOString(),
|
|
required_role: this.getRequiredRoleToViewRevision.execute({ createdAt: domain.props.dates.createdAt }).getValue(),
|
|
}
|
|
}
|
|
}
|