@hed-hog/operations 0.0.318 → 0.0.321

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/dist/controllers/operations-collaborator-costs.controller.d.ts +144 -0
  2. package/dist/controllers/operations-collaborator-costs.controller.d.ts.map +1 -0
  3. package/dist/controllers/operations-collaborator-costs.controller.js +162 -0
  4. package/dist/controllers/operations-collaborator-costs.controller.js.map +1 -0
  5. package/dist/controllers/operations-collaborators.controller.d.ts +14 -0
  6. package/dist/controllers/operations-collaborators.controller.d.ts.map +1 -1
  7. package/dist/controllers/operations-collaborators.controller.js +11 -0
  8. package/dist/controllers/operations-collaborators.controller.js.map +1 -1
  9. package/dist/controllers/operations-contracts.controller.d.ts +9 -9
  10. package/dist/controllers/operations-projects.controller.d.ts +31 -0
  11. package/dist/controllers/operations-projects.controller.d.ts.map +1 -1
  12. package/dist/controllers/operations-projects.controller.js +23 -0
  13. package/dist/controllers/operations-projects.controller.js.map +1 -1
  14. package/dist/controllers/operations-reports.controller.d.ts +199 -0
  15. package/dist/controllers/operations-reports.controller.d.ts.map +1 -0
  16. package/dist/controllers/operations-reports.controller.js +53 -0
  17. package/dist/controllers/operations-reports.controller.js.map +1 -0
  18. package/dist/controllers/operations-tasks.controller.d.ts +41 -2
  19. package/dist/controllers/operations-tasks.controller.d.ts.map +1 -1
  20. package/dist/controllers/operations-tasks.controller.js +17 -5
  21. package/dist/controllers/operations-tasks.controller.js.map +1 -1
  22. package/dist/dto/create-collaborator-cost.dto.d.ts +16 -0
  23. package/dist/dto/create-collaborator-cost.dto.d.ts.map +1 -0
  24. package/dist/dto/create-collaborator-cost.dto.js +88 -0
  25. package/dist/dto/create-collaborator-cost.dto.js.map +1 -0
  26. package/dist/dto/create-collaborator.dto.d.ts +0 -1
  27. package/dist/dto/create-collaborator.dto.d.ts.map +1 -1
  28. package/dist/dto/create-collaborator.dto.js +0 -6
  29. package/dist/dto/create-collaborator.dto.js.map +1 -1
  30. package/dist/dto/create-cost-type.dto.d.ts +13 -0
  31. package/dist/dto/create-cost-type.dto.d.ts.map +1 -0
  32. package/dist/dto/create-cost-type.dto.js +87 -0
  33. package/dist/dto/create-cost-type.dto.js.map +1 -0
  34. package/dist/dto/list-approvals.dto.d.ts +2 -0
  35. package/dist/dto/list-approvals.dto.d.ts.map +1 -1
  36. package/dist/dto/list-approvals.dto.js +10 -0
  37. package/dist/dto/list-approvals.dto.js.map +1 -1
  38. package/dist/dto/list-collaborator-costs.dto.d.ts +5 -0
  39. package/dist/dto/list-collaborator-costs.dto.d.ts.map +1 -0
  40. package/dist/dto/list-collaborator-costs.dto.js +23 -0
  41. package/dist/dto/list-collaborator-costs.dto.js.map +1 -0
  42. package/dist/dto/list-cost-types.dto.d.ts +6 -0
  43. package/dist/dto/list-cost-types.dto.d.ts.map +1 -0
  44. package/dist/dto/list-cost-types.dto.js +35 -0
  45. package/dist/dto/list-cost-types.dto.js.map +1 -0
  46. package/dist/dto/list-my-projects.dto.d.ts +5 -0
  47. package/dist/dto/list-my-projects.dto.d.ts.map +1 -0
  48. package/dist/dto/list-my-projects.dto.js +23 -0
  49. package/dist/dto/list-my-projects.dto.js.map +1 -0
  50. package/dist/dto/list-my-tasks.dto.d.ts +6 -0
  51. package/dist/dto/list-my-tasks.dto.d.ts.map +1 -0
  52. package/dist/dto/list-my-tasks.dto.js +33 -0
  53. package/dist/dto/list-my-tasks.dto.js.map +1 -0
  54. package/dist/dto/list-projects.dto.d.ts +1 -0
  55. package/dist/dto/list-projects.dto.d.ts.map +1 -1
  56. package/dist/dto/list-projects.dto.js +7 -0
  57. package/dist/dto/list-projects.dto.js.map +1 -1
  58. package/dist/dto/list-reports.dto.d.ts +16 -0
  59. package/dist/dto/list-reports.dto.d.ts.map +1 -0
  60. package/dist/dto/list-reports.dto.js +75 -0
  61. package/dist/dto/list-reports.dto.js.map +1 -0
  62. package/dist/dto/list-tasks.dto.d.ts +2 -0
  63. package/dist/dto/list-tasks.dto.d.ts.map +1 -1
  64. package/dist/dto/list-tasks.dto.js +12 -0
  65. package/dist/dto/list-tasks.dto.js.map +1 -1
  66. package/dist/dto/list-timesheets.dto.d.ts +2 -0
  67. package/dist/dto/list-timesheets.dto.d.ts.map +1 -1
  68. package/dist/dto/list-timesheets.dto.js +10 -0
  69. package/dist/dto/list-timesheets.dto.js.map +1 -1
  70. package/dist/dto/update-collaborator-cost.dto.d.ts +6 -0
  71. package/dist/dto/update-collaborator-cost.dto.d.ts.map +1 -0
  72. package/dist/dto/update-collaborator-cost.dto.js +9 -0
  73. package/dist/dto/update-collaborator-cost.dto.js.map +1 -0
  74. package/dist/dto/update-task.dto.d.ts +1 -0
  75. package/dist/dto/update-task.dto.d.ts.map +1 -1
  76. package/dist/dto/update-task.dto.js +6 -0
  77. package/dist/dto/update-task.dto.js.map +1 -1
  78. package/dist/operations.module.d.ts.map +1 -1
  79. package/dist/operations.module.js +4 -0
  80. package/dist/operations.module.js.map +1 -1
  81. package/dist/operations.service.d.ts +457 -3
  82. package/dist/operations.service.d.ts.map +1 -1
  83. package/dist/operations.service.js +1445 -208
  84. package/dist/operations.service.js.map +1 -1
  85. package/dist/operations.service.spec.js +31 -7
  86. package/dist/operations.service.spec.js.map +1 -1
  87. package/hedhog/data/menu.yaml +112 -7
  88. package/hedhog/data/operations_cost_type.yaml +166 -0
  89. package/hedhog/data/route.yaml +185 -0
  90. package/hedhog/frontend/app/_components/collaborator-costs-section.tsx.ejs +884 -0
  91. package/hedhog/frontend/app/_components/collaborator-details-screen.tsx.ejs +80 -1
  92. package/hedhog/frontend/app/_components/collaborator-form-screen.tsx.ejs +219 -94
  93. package/hedhog/frontend/app/_components/contract-details-screen.tsx.ejs +21 -32
  94. package/hedhog/frontend/app/_components/contract-form-screen.tsx.ejs +178 -89
  95. package/hedhog/frontend/app/_components/my-project-summary-screen.tsx.ejs +1185 -0
  96. package/hedhog/frontend/app/_components/operations-calendar-view.tsx.ejs +306 -0
  97. package/hedhog/frontend/app/_components/project-details-screen.tsx.ejs +943 -782
  98. package/hedhog/frontend/app/_components/task-detail-sheet.tsx.ejs +223 -0
  99. package/hedhog/frontend/app/_lib/api.ts.ejs +162 -0
  100. package/hedhog/frontend/app/_lib/types.ts.ejs +227 -1
  101. package/hedhog/frontend/app/_lib/utils/format.ts.ejs +11 -3
  102. package/hedhog/frontend/app/approvals/page.tsx.ejs +191 -46
  103. package/hedhog/frontend/app/collaborators/page.tsx.ejs +133 -25
  104. package/hedhog/frontend/app/my-projects/[id]/page.tsx.ejs +11 -0
  105. package/hedhog/frontend/app/my-projects/page.tsx.ejs +440 -0
  106. package/hedhog/frontend/app/my-tasks/page.tsx.ejs +1304 -0
  107. package/hedhog/frontend/app/reports/collaborators/page.tsx.ejs +771 -0
  108. package/hedhog/frontend/app/reports/projects/page.tsx.ejs +809 -0
  109. package/hedhog/frontend/app/timesheets/page.tsx.ejs +322 -58
  110. package/hedhog/frontend/messages/en.json +234 -25
  111. package/hedhog/frontend/messages/pt.json +234 -25
  112. package/hedhog/table/operations_collaborator.yaml +0 -4
  113. package/hedhog/table/operations_collaborator_compensation_history.yaml +28 -0
  114. package/hedhog/table/operations_collaborator_cost.yaml +56 -0
  115. package/hedhog/table/operations_cost_type.yaml +38 -0
  116. package/package.json +7 -7
  117. package/src/controllers/operations-collaborator-costs.controller.ts +147 -0
  118. package/src/controllers/operations-collaborators.controller.ts +19 -8
  119. package/src/controllers/operations-projects.controller.ts +19 -8
  120. package/src/controllers/operations-reports.controller.ts +32 -0
  121. package/src/controllers/operations-tasks.controller.ts +32 -12
  122. package/src/dto/create-collaborator-cost.dto.ts +78 -0
  123. package/src/dto/create-collaborator.dto.ts +9 -14
  124. package/src/dto/create-cost-type.dto.ts +62 -0
  125. package/src/dto/list-approvals.dto.ts +8 -0
  126. package/src/dto/list-collaborator-costs.dto.ts +8 -0
  127. package/src/dto/list-cost-types.dto.ts +19 -0
  128. package/src/dto/list-my-projects.dto.ts +8 -0
  129. package/src/dto/list-my-tasks.dto.ts +17 -0
  130. package/src/dto/list-projects.dto.ts +7 -1
  131. package/src/dto/list-reports.dto.ts +51 -0
  132. package/src/dto/list-tasks.dto.ts +11 -1
  133. package/src/dto/list-timesheets.dto.ts +8 -0
  134. package/src/dto/update-collaborator-cost.dto.ts +4 -0
  135. package/src/dto/update-task.dto.ts +6 -0
  136. package/src/operations.module.ts +4 -0
  137. package/src/operations.service.spec.ts +45 -7
  138. package/src/operations.service.ts +1988 -221
@@ -0,0 +1,147 @@
1
+ import { Role, User } from '@hed-hog/api';
2
+ import {
3
+ Body,
4
+ Controller,
5
+ Delete,
6
+ Get,
7
+ Param,
8
+ ParseIntPipe,
9
+ Patch,
10
+ Post,
11
+ Query,
12
+ } from '@nestjs/common';
13
+ import { CreateCollaboratorCostDto } from '../dto/create-collaborator-cost.dto';
14
+ import { CreateCostTypeDto } from '../dto/create-cost-type.dto';
15
+ import { ListCostTypesDto } from '../dto/list-cost-types.dto';
16
+ import { UpdateCollaboratorCostDto } from '../dto/update-collaborator-cost.dto';
17
+ import { OperationsService } from '../operations.service';
18
+
19
+ @Role()
20
+ @Controller('operations')
21
+ export class OperationsCollaboratorCostsController {
22
+ constructor(private readonly operationsService: OperationsService) {}
23
+
24
+ // ─── Cost Types ──────────────────────────────────────────────────────────
25
+
26
+ @Get('cost-types')
27
+ listCostTypes(@User() user, @Query() filters: ListCostTypesDto) {
28
+ return this.operationsService.listCostTypes(
29
+ Number(user?.id || 0),
30
+ filters,
31
+ );
32
+ }
33
+
34
+ @Get('collaborator-cost-types')
35
+ listCollaboratorCostTypes(@User() user, @Query() filters: ListCostTypesDto) {
36
+ return this.operationsService.listCostTypes(
37
+ Number(user?.id || 0),
38
+ filters,
39
+ );
40
+ }
41
+
42
+ @Post('cost-types')
43
+ createCostType(@User() user, @Body() data: CreateCostTypeDto) {
44
+ return this.operationsService.createCostType(
45
+ Number(user?.id || 0),
46
+ data,
47
+ );
48
+ }
49
+
50
+ @Post('collaborator-cost-types')
51
+ createCollaboratorCostType(@User() user, @Body() data: CreateCostTypeDto) {
52
+ return this.operationsService.createCostType(
53
+ Number(user?.id || 0),
54
+ data,
55
+ );
56
+ }
57
+
58
+ // ─── Collaborator Costs ───────────────────────────────────────────────────
59
+
60
+ @Get('collaborators/:id/costs/summary')
61
+ getCollaboratorCostsSummary(
62
+ @User() user,
63
+ @Param('id', ParseIntPipe) collaboratorId: number,
64
+ ) {
65
+ return this.operationsService.getCollaboratorCostsSummary(
66
+ Number(user?.id || 0),
67
+ collaboratorId,
68
+ );
69
+ }
70
+
71
+ @Get('collaborators/:id/costs')
72
+ listCollaboratorCosts(
73
+ @User() user,
74
+ @Param('id', ParseIntPipe) collaboratorId: number,
75
+ ) {
76
+ return this.operationsService.listCollaboratorCosts(
77
+ Number(user?.id || 0),
78
+ collaboratorId,
79
+ );
80
+ }
81
+
82
+ @Post('collaborators/:id/costs')
83
+ createCollaboratorCost(
84
+ @User() user,
85
+ @Param('id', ParseIntPipe) collaboratorId: number,
86
+ @Body() data: CreateCollaboratorCostDto,
87
+ ) {
88
+ return this.operationsService.createCollaboratorCost(
89
+ Number(user?.id || 0),
90
+ collaboratorId,
91
+ data,
92
+ );
93
+ }
94
+
95
+ @Patch('collaborators/:id/costs/:costId')
96
+ updateCollaboratorCost(
97
+ @User() user,
98
+ @Param('id', ParseIntPipe) collaboratorId: number,
99
+ @Param('costId', ParseIntPipe) costId: number,
100
+ @Body() data: UpdateCollaboratorCostDto,
101
+ ) {
102
+ return this.operationsService.updateCollaboratorCost(
103
+ Number(user?.id || 0),
104
+ collaboratorId,
105
+ costId,
106
+ data,
107
+ );
108
+ }
109
+
110
+ @Patch('collaborator-costs/:id')
111
+ updateCollaboratorCostById(
112
+ @User() user,
113
+ @Param('id', ParseIntPipe) costId: number,
114
+ @Body() data: UpdateCollaboratorCostDto,
115
+ ) {
116
+ return this.operationsService.updateCollaboratorCost(
117
+ Number(user?.id || 0),
118
+ 0,
119
+ costId,
120
+ data,
121
+ );
122
+ }
123
+
124
+ @Delete('collaborators/:id/costs/:costId')
125
+ deleteCollaboratorCost(
126
+ @User() user,
127
+ @Param('id', ParseIntPipe) collaboratorId: number,
128
+ @Param('costId', ParseIntPipe) costId: number,
129
+ ) {
130
+ return this.operationsService.deleteCollaboratorCost(
131
+ Number(user?.id || 0),
132
+ collaboratorId,
133
+ costId,
134
+ );
135
+ }
136
+
137
+ @Delete('collaborator-costs/:id')
138
+ deleteCollaboratorCostById(
139
+ @User() user,
140
+ @Param('id', ParseIntPipe) costId: number,
141
+ ) {
142
+ return this.operationsService.deleteCollaboratorCostById(
143
+ Number(user?.id || 0),
144
+ costId,
145
+ );
146
+ }
147
+ }
@@ -1,13 +1,13 @@
1
1
  import { Role, User } from '@hed-hog/api';
2
2
  import {
3
- Body,
4
- Controller,
5
- Get,
6
- Param,
7
- ParseIntPipe,
8
- Patch,
9
- Post,
10
- Query,
3
+ Body,
4
+ Controller,
5
+ Get,
6
+ Param,
7
+ ParseIntPipe,
8
+ Patch,
9
+ Post,
10
+ Query,
11
11
  } from '@nestjs/common';
12
12
  import { CreateCollaboratorDto } from '../dto/create-collaborator.dto';
13
13
  import { ListCollaboratorsDto } from '../dto/list-collaborators.dto';
@@ -45,6 +45,17 @@ export class OperationsCollaboratorsController {
45
45
  return this.operationsService.getTeam(Number(user?.id || 0));
46
46
  }
47
47
 
48
+ @Get('collaborators/:id/compensation-history')
49
+ getCollaboratorCompensationHistory(
50
+ @User() user,
51
+ @Param('id', ParseIntPipe) id: number,
52
+ ) {
53
+ return this.operationsService.getCollaboratorCompensationHistory(
54
+ Number(user?.id || 0),
55
+ id,
56
+ );
57
+ }
58
+
48
59
  @Get('collaborators/:id')
49
60
  getCollaborator(@User() user, @Param('id', ParseIntPipe) id: number) {
50
61
  return this.operationsService.getCollaboratorByIdForUser(
@@ -1,14 +1,15 @@
1
1
  import { Role, User } from '@hed-hog/api';
2
2
  import {
3
- Body,
4
- Controller,
5
- Get,
6
- Param,
7
- ParseIntPipe,
8
- Patch,
9
- Post,
10
- Query,
3
+ Body,
4
+ Controller,
5
+ Get,
6
+ Param,
7
+ ParseIntPipe,
8
+ Patch,
9
+ Post,
10
+ Query,
11
11
  } from '@nestjs/common';
12
+ import { ListMyProjectsDto } from '../dto/list-my-projects.dto';
12
13
  import { ListOperationsProjectOptionsDto } from '../dto/list-project-options.dto';
13
14
  import { ListProjectsDto } from '../dto/list-projects.dto';
14
15
  import { OperationsService } from '../operations.service';
@@ -29,6 +30,16 @@ export class OperationsProjectsController {
29
30
  );
30
31
  }
31
32
 
33
+ @Get('my-projects')
34
+ listMyProjects(@User() user, @Query() filters: ListMyProjectsDto) {
35
+ return this.operationsService.listMyProjects(Number(user?.id || 0), filters);
36
+ }
37
+
38
+ @Get('my-projects/:id/summary')
39
+ getMyProjectSummary(@User() user, @Param('id', ParseIntPipe) id: number) {
40
+ return this.operationsService.getMyProjectSummary(Number(user?.id || 0), id);
41
+ }
42
+
32
43
  @Get('projects')
33
44
  listProjects(@User() user, @Query() filters: ListProjectsDto) {
34
45
  return this.operationsService.listProjects(Number(user?.id || 0), filters);
@@ -0,0 +1,32 @@
1
+ import { Role, User } from '@hed-hog/api';
2
+ import { Controller, Get, Query } from '@nestjs/common';
3
+ import {
4
+ ListCollaboratorsReportDto,
5
+ ListProjectsReportDto,
6
+ } from '../dto/list-reports.dto';
7
+ import { OperationsService } from '../operations.service';
8
+
9
+ @Role()
10
+ @Controller('operations')
11
+ export class OperationsReportsController {
12
+ constructor(private readonly operationsService: OperationsService) {}
13
+
14
+ @Get('reports/projects')
15
+ getProjectsReport(@User() user, @Query() filters: ListProjectsReportDto) {
16
+ return this.operationsService.getProjectsReport(
17
+ Number(user?.id || 0),
18
+ filters,
19
+ );
20
+ }
21
+
22
+ @Get('reports/collaborators')
23
+ getCollaboratorsReport(
24
+ @User() user,
25
+ @Query() filters: ListCollaboratorsReportDto,
26
+ ) {
27
+ return this.operationsService.getCollaboratorsReport(
28
+ Number(user?.id || 0),
29
+ filters,
30
+ );
31
+ }
32
+ }
@@ -1,16 +1,17 @@
1
1
  import { Role, User } from '@hed-hog/api';
2
- import { Pagination } from '@hed-hog/api-pagination';
3
2
  import {
4
- Body,
5
- Controller,
6
- Delete,
7
- Get,
8
- Param,
9
- ParseIntPipe,
10
- Patch,
11
- Post,
3
+ Body,
4
+ Controller,
5
+ Delete,
6
+ Get,
7
+ Param,
8
+ ParseIntPipe,
9
+ Patch,
10
+ Post,
11
+ Query,
12
12
  } from '@nestjs/common';
13
13
  import { CreateOperationsTaskDto } from '../dto/create-task.dto';
14
+ import { ListMyTasksDto } from '../dto/list-my-tasks.dto';
14
15
  import { ListOperationsTasksDto } from '../dto/list-tasks.dto';
15
16
  import { UpdateOperationsTaskDto } from '../dto/update-task.dto';
16
17
  import { OperationsService } from '../operations.service';
@@ -23,7 +24,7 @@ export class OperationsTasksController {
23
24
  @Get('tasks')
24
25
  listTasks(
25
26
  @User() user,
26
- @Pagination() paginationParams: ListOperationsTasksDto,
27
+ @Query() paginationParams: ListOperationsTasksDto,
27
28
  ) {
28
29
  return this.operationsService.listTasks(
29
30
  Number(user?.id || 0),
@@ -31,6 +32,17 @@ export class OperationsTasksController {
31
32
  );
32
33
  }
33
34
 
35
+ @Get('my-tasks')
36
+ listMyTasks(
37
+ @User() user,
38
+ @Query() paginationParams: ListMyTasksDto,
39
+ ) {
40
+ return this.operationsService.listMyTasks(
41
+ Number(user?.id || 0),
42
+ paginationParams,
43
+ );
44
+ }
45
+
34
46
  @Get('projects/:id/tasks')
35
47
  listProjectBoardTasks(
36
48
  @User() user,
@@ -57,7 +69,15 @@ export class OperationsTasksController {
57
69
  }
58
70
 
59
71
  @Delete('tasks/:id')
60
- removeTask(@User() user, @Param('id', ParseIntPipe) id: number) {
61
- return this.operationsService.removeTask(Number(user?.id || 0), id);
72
+ removeTask(
73
+ @User() user,
74
+ @Param('id', ParseIntPipe) id: number,
75
+ @Query('permanent') permanent?: string,
76
+ ) {
77
+ return this.operationsService.removeTask(
78
+ Number(user?.id || 0),
79
+ id,
80
+ permanent === 'true'
81
+ );
62
82
  }
63
83
  }
@@ -0,0 +1,78 @@
1
+ import { Transform } from 'class-transformer';
2
+ import {
3
+ IsBoolean,
4
+ IsIn,
5
+ IsNumber,
6
+ IsOptional,
7
+ IsString,
8
+ MaxLength,
9
+ Min,
10
+ } from 'class-validator';
11
+
12
+ export const COST_RECURRENCE_VALUES = [
13
+ 'one_time',
14
+ 'monthly',
15
+ 'quarterly',
16
+ 'yearly',
17
+ ] as const;
18
+ export type CostRecurrence = (typeof COST_RECURRENCE_VALUES)[number];
19
+
20
+ export class CreateCollaboratorCostDto {
21
+ @Transform(({ value }) =>
22
+ value === '' || value === undefined || value === null ? undefined : Number(value)
23
+ )
24
+ @IsNumber()
25
+ costTypeId!: number;
26
+
27
+ @Transform(({ value }) =>
28
+ value === '' || value === undefined || value === null ? undefined : Number(value)
29
+ )
30
+ @IsNumber()
31
+ @Min(0)
32
+ amount!: number;
33
+
34
+ @IsOptional()
35
+ @IsString()
36
+ @MaxLength(3)
37
+ currency?: string;
38
+
39
+ @IsOptional()
40
+ @IsIn(COST_RECURRENCE_VALUES)
41
+ recurrence?: CostRecurrence;
42
+
43
+ @IsOptional()
44
+ @Transform(({ value }) => {
45
+ if (value === '' || value === undefined || value === null) return undefined;
46
+ return value === true || value === 'true' || value === '1';
47
+ })
48
+ @IsBoolean()
49
+ allocatable?: boolean;
50
+
51
+ @IsOptional()
52
+ @IsString()
53
+ referenceDate?: string | null;
54
+
55
+ @IsOptional()
56
+ @IsString()
57
+ startDate?: string | null;
58
+
59
+ @IsOptional()
60
+ @IsString()
61
+ endDate?: string | null;
62
+
63
+ @IsOptional()
64
+ @Transform(({ value }) =>
65
+ value === '' || value === undefined || value === null ? undefined : Number(value)
66
+ )
67
+ @IsNumber()
68
+ @Min(1)
69
+ depreciationMonths?: number | null;
70
+
71
+ @IsOptional()
72
+ @IsString()
73
+ description?: string | null;
74
+
75
+ @IsOptional()
76
+ @IsString()
77
+ notes?: string | null;
78
+ }
@@ -1,14 +1,14 @@
1
1
  import { Transform, Type } from 'class-transformer';
2
2
  import {
3
- IsBoolean,
4
- IsIn,
5
- IsInt,
6
- IsNumber,
7
- IsObject,
8
- IsOptional,
9
- IsString,
10
- MaxLength,
11
- ValidateNested,
3
+ IsBoolean,
4
+ IsIn,
5
+ IsInt,
6
+ IsNumber,
7
+ IsObject,
8
+ IsOptional,
9
+ IsString,
10
+ MaxLength,
11
+ ValidateNested,
12
12
  } from 'class-validator';
13
13
 
14
14
  class CollaboratorWeeklyScheduleDayDto {
@@ -136,11 +136,6 @@ export class CreateCollaboratorDto {
136
136
  @MaxLength(80)
137
137
  collaboratorType?: string | null;
138
138
 
139
- @IsOptional()
140
- @IsString()
141
- @MaxLength(120)
142
- department?: string | null;
143
-
144
139
  @IsOptional()
145
140
  @Transform(({ value }) =>
146
141
  value === '' || value === undefined || value === null ? undefined : Number(value)
@@ -0,0 +1,62 @@
1
+ import { Transform } from 'class-transformer';
2
+ import { IsBoolean, IsIn, IsOptional, IsString, MaxLength } from 'class-validator';
3
+
4
+ export const COST_TYPE_RECURRENCE_VALUES = [
5
+ 'one_time',
6
+ 'monthly',
7
+ 'quarterly',
8
+ 'yearly',
9
+ ] as const;
10
+
11
+ export class CreateCostTypeDto {
12
+ @IsString()
13
+ @MaxLength(120)
14
+ name!: string;
15
+
16
+ @IsOptional()
17
+ @IsString()
18
+ @MaxLength(80)
19
+ slug?: string | null;
20
+
21
+ @IsOptional()
22
+ @IsString()
23
+ @MaxLength(40)
24
+ code?: string | null;
25
+
26
+ @IsOptional()
27
+ @IsString()
28
+ @MaxLength(80)
29
+ category?: string | null;
30
+
31
+ @IsOptional()
32
+ @IsString()
33
+ description?: string | null;
34
+
35
+ @IsOptional()
36
+ @IsIn(COST_TYPE_RECURRENCE_VALUES)
37
+ defaultRecurrence?: string | null;
38
+
39
+ @IsOptional()
40
+ @Transform(({ value }) => {
41
+ if (value === '' || value === undefined || value === null) return undefined;
42
+ return value === true || value === 'true' || value === '1';
43
+ })
44
+ @IsBoolean()
45
+ isAllocatable?: boolean | null;
46
+
47
+ @IsOptional()
48
+ @Transform(({ value }) => {
49
+ if (value === '' || value === undefined || value === null) return undefined;
50
+ return value === true || value === 'true' || value === '1';
51
+ })
52
+ @IsBoolean()
53
+ isDepreciable?: boolean | null;
54
+
55
+ @IsOptional()
56
+ @Transform(({ value }) => {
57
+ if (value === '' || value === undefined || value === null) return undefined;
58
+ return value === true || value === 'true' || value === '1';
59
+ })
60
+ @IsBoolean()
61
+ isActive?: boolean;
62
+ }
@@ -9,4 +9,12 @@ export class ListApprovalsDto extends PaginationDTO {
9
9
  @IsOptional()
10
10
  @IsString()
11
11
  targetType?: string;
12
+
13
+ @IsOptional()
14
+ @IsString()
15
+ dateFrom?: string;
16
+
17
+ @IsOptional()
18
+ @IsString()
19
+ dateTo?: string;
12
20
  }
@@ -0,0 +1,8 @@
1
+ import { PaginationDTO } from '@hed-hog/api-pagination';
2
+ import { IsOptional, IsString } from 'class-validator';
3
+
4
+ export class ListCollaboratorCostsDto extends PaginationDTO {
5
+ @IsOptional()
6
+ @IsString()
7
+ declare search: string;
8
+ }
@@ -0,0 +1,19 @@
1
+ import { PaginationDTO } from '@hed-hog/api-pagination';
2
+ import { Transform } from 'class-transformer';
3
+ import { IsBoolean, IsOptional, IsString } from 'class-validator';
4
+
5
+ export class ListCostTypesDto extends PaginationDTO {
6
+ @IsOptional()
7
+ @IsString()
8
+ declare search: string;
9
+
10
+ @IsOptional()
11
+ @Transform(({ value }) => {
12
+ if (value === '' || value === undefined || value === null) {
13
+ return undefined;
14
+ }
15
+ return value === true || value === 'true' || value === '1';
16
+ })
17
+ @IsBoolean()
18
+ active?: boolean;
19
+ }
@@ -0,0 +1,8 @@
1
+ import { PaginationDTO } from '@hed-hog/api-pagination';
2
+ import { IsOptional, IsString } from 'class-validator';
3
+
4
+ export class ListMyProjectsDto extends PaginationDTO {
5
+ @IsOptional()
6
+ @IsString()
7
+ status?: string;
8
+ }
@@ -0,0 +1,17 @@
1
+ import { PaginationDTO } from '@hed-hog/api-pagination';
2
+ import { IsIn, IsOptional } from 'class-validator';
3
+ import { Transform } from 'class-transformer';
4
+ import { IsBoolean } from 'class-validator';
5
+
6
+ export class ListMyTasksDto extends PaginationDTO {
7
+ @IsOptional()
8
+ @IsIn(['todo', 'doing', 'review', 'done'], {
9
+ message: 'status must be todo, doing, review, or done',
10
+ })
11
+ status?: 'todo' | 'doing' | 'review' | 'done';
12
+
13
+ @IsOptional()
14
+ @Transform(({ value }) => value === 'true' || value === true)
15
+ @IsBoolean()
16
+ archived?: boolean;
17
+ }
@@ -1,8 +1,14 @@
1
1
  import { PaginationDTO } from '@hed-hog/api-pagination';
2
- import { IsOptional, IsString } from 'class-validator';
2
+ import { Transform } from 'class-transformer';
3
+ import { IsBoolean, IsOptional, IsString } from 'class-validator';
3
4
 
4
5
  export class ListProjectsDto extends PaginationDTO {
5
6
  @IsOptional()
6
7
  @IsString()
7
8
  status?: string;
9
+
10
+ @IsOptional()
11
+ @Transform(({ value }) => value === 'true' || value === true)
12
+ @IsBoolean()
13
+ myOnly?: boolean;
8
14
  }
@@ -0,0 +1,51 @@
1
+ import { IsIn, IsOptional, IsString } from 'class-validator';
2
+
3
+ export const OPERATIONS_REPORT_SCENARIOS = [
4
+ 'base',
5
+ 'growth',
6
+ 'conservative',
7
+ ] as const;
8
+
9
+ export class ListProjectsReportDto {
10
+ @IsOptional()
11
+ @IsString()
12
+ from?: string;
13
+
14
+ @IsOptional()
15
+ @IsString()
16
+ to?: string;
17
+
18
+ @IsOptional()
19
+ @IsString()
20
+ status?: string;
21
+
22
+ @IsOptional()
23
+ @IsString()
24
+ client?: string;
25
+
26
+ @IsOptional()
27
+ @IsIn(OPERATIONS_REPORT_SCENARIOS)
28
+ scenario?: string;
29
+ }
30
+
31
+ export class ListCollaboratorsReportDto {
32
+ @IsOptional()
33
+ @IsString()
34
+ from?: string;
35
+
36
+ @IsOptional()
37
+ @IsString()
38
+ to?: string;
39
+
40
+ @IsOptional()
41
+ @IsString()
42
+ department?: string;
43
+
44
+ @IsOptional()
45
+ @IsString()
46
+ contractType?: string;
47
+
48
+ @IsOptional()
49
+ @IsIn(OPERATIONS_REPORT_SCENARIOS)
50
+ scenario?: string;
51
+ }
@@ -1,6 +1,6 @@
1
1
  import { PaginationDTO } from '@hed-hog/api-pagination';
2
2
  import { Transform } from 'class-transformer';
3
- import { IsIn, IsInt, IsOptional } from 'class-validator';
3
+ import { IsBoolean, IsIn, IsInt, IsOptional } from 'class-validator';
4
4
 
5
5
  export class ListOperationsTasksDto extends PaginationDTO {
6
6
  @IsOptional()
@@ -22,4 +22,14 @@ export class ListOperationsTasksDto extends PaginationDTO {
22
22
  message: 'status must be todo, doing, review, or done',
23
23
  })
24
24
  status?: 'todo' | 'doing' | 'review' | 'done';
25
+
26
+ @IsOptional()
27
+ @Transform(({ value }) => value === 'true' || value === true)
28
+ @IsBoolean()
29
+ myOnly?: boolean;
30
+
31
+ @IsOptional()
32
+ @Transform(({ value }) => value === 'true' || value === true)
33
+ @IsBoolean()
34
+ archived?: boolean;
25
35
  }
@@ -5,4 +5,12 @@ export class ListTimesheetsDto extends PaginationDTO {
5
5
  @IsOptional()
6
6
  @IsString()
7
7
  status?: string;
8
+
9
+ @IsOptional()
10
+ @IsString()
11
+ dateFrom?: string;
12
+
13
+ @IsOptional()
14
+ @IsString()
15
+ dateTo?: string;
8
16
  }
@@ -0,0 +1,4 @@
1
+ import { PartialType } from '@nestjs/mapped-types';
2
+ import { CreateCollaboratorCostDto } from './create-collaborator-cost.dto';
3
+
4
+ export class UpdateCollaboratorCostDto extends PartialType(CreateCollaboratorCostDto) {}