import { Transform, Type } from 'class-transformer' import { parseISO } from '../utils/date' import { Patient } from './patient.model' export type MESSAGE_TAGS = '24_HOUR_REMAINING' | '1_HOUR_REMAINING' | 'FOOD_PLAN_ACTIVATED' export class Message { id: string user_id: string patient_id: string text: string replied_by_user_id: string file_url: string tags: { tags: Array } @Transform(value => parseISO(value), { toClassOnly: true }) send_at: Date @Transform(value => parseISO(value), { toClassOnly: true }) view_at: Date @Type(() => Patient) patient: Patient constructor(args: Partial) { Object.assign(this, args) } }