-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCooperation.ts
More file actions
33 lines (28 loc) · 891 Bytes
/
Cooperation.ts
File metadata and controls
33 lines (28 loc) · 891 Bytes
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
import { Transform, Type } from 'class-transformer';
import { IsInt, Min, ValidateNested } from 'class-validator';
import { Entity, ManyToOne } from 'typeorm';
import { ListChunk } from '../Base';
import { Organization } from '../Organization';
import { Tag } from '../Tag';
import { ActivityBase } from './Activity';
@Entity()
export class Cooperation extends ActivityBase {
@Type(() => Tag)
@Transform(({ value }) => Tag.from(value))
@ValidateNested()
@ManyToOne(() => Tag)
level: Tag;
@Type(() => Organization)
@Transform(({ value }) => Organization.from(value))
@ValidateNested()
@ManyToOne(() => Organization)
partner: Organization;
}
export class CooperationListChunk implements ListChunk<Cooperation> {
@IsInt()
@Min(0)
count: number;
@Type(() => Cooperation)
@ValidateNested({ each: true })
list: Cooperation[];
}