-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrecord.model.ts
More file actions
61 lines (46 loc) · 1.12 KB
/
record.model.ts
File metadata and controls
61 lines (46 loc) · 1.12 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import { ObjectType, Field, ID } from '@nestjs/graphql';
import { EmployeeModel } from '../../employees/model/employee.model';
import { ProjectModel } from '../../project/model/project.model';
/**
* return types for querying employee
*/
@ObjectType()
export class RecordInsertOrUpdateModel {
@Field(() => String, { nullable: true })
id: string | null;
@Field(() => ID)
employeeId: string;
@Field(() => ID)
projectId: string;
@Field()
date: Date;
@Field()
hours: number;
}
@ObjectType()
export class RecordWithFavoriteProjectModel {
@Field(() => String, { nullable: true })
date: string | null;
@Field()
hours: number;
}
@ObjectType()
export class GroupedRecordWithFavoriteProjectModel {
@Field()
projectId: string;
@Field()
projectName: string;
@Field()
description: string;
@Field()
isFavorite: boolean;
@Field(() => [RecordWithFavoriteProjectModel])
records: RecordWithFavoriteProjectModel[];
}
@ObjectType()
export class RecordModel extends RecordInsertOrUpdateModel {
@Field(() => EmployeeModel)
employee: EmployeeModel;
@Field(() => ProjectModel)
project: ProjectModel;
}