-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathpatient-category.ts
40 lines (34 loc) · 1.18 KB
/
patient-category.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { Type } from 'class-transformer';
import { ArrayNotEmpty, IsArray, ValidateNested } from 'class-validator';
import { IsValue } from '../utils/validators';
import { PatientTemplate } from './patient-template';
import { getCreate, ImageProperties } from './utils';
import { PatientStatusCode } from './utils/patient-status-code';
export class PatientCategory {
@IsValue('patientCategory' as const)
public readonly type = 'patientCategory';
@ValidateNested()
@Type(() => PatientStatusCode)
public readonly name: PatientStatusCode;
@ValidateNested()
@Type(() => ImageProperties)
public readonly image: ImageProperties;
@IsArray()
@ArrayNotEmpty()
@ValidateNested({ each: true })
@Type(() => PatientTemplate)
public readonly patientTemplates: readonly PatientTemplate[] = [];
/**
* @deprecated Use {@link create} instead
*/
constructor(
name: string,
image: ImageProperties,
patientTemplates: PatientTemplate[]
) {
this.name = PatientStatusCode.create(name);
this.image = image;
this.patientTemplates = patientTemplates;
}
static readonly create = getCreate(this);
}