@flusys/nestjs-task-manager 7.1.0 → 8.0.0

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 (163) hide show
  1. package/config/index.d.ts +3 -3
  2. package/controllers/index.d.ts +5 -5
  3. package/controllers/task-board.controller.d.ts +3 -3
  4. package/controllers/task-comment.controller.d.ts +2 -2
  5. package/controllers/task-label.controller.d.ts +2 -2
  6. package/controllers/task-list.controller.d.ts +3 -3
  7. package/controllers/task.controller.d.ts +4 -4
  8. package/docs/index.d.ts +1 -1
  9. package/docs/task-manager-swagger.config.d.ts +1 -1
  10. package/dtos/index.d.ts +5 -5
  11. package/dtos/task-board.dto.d.ts +1 -1
  12. package/dtos/task.dto.d.ts +2 -2
  13. package/entities/index.d.ts +19 -19
  14. package/entities/task-board-with-company.entity.d.ts +1 -1
  15. package/fesm/234.js +1393 -0
  16. package/fesm/431.js +981 -0
  17. package/fesm/827.js +1054 -0
  18. package/fesm/988.js +881 -0
  19. package/fesm/config/index.js +156 -3
  20. package/fesm/controllers/index.js +21 -5
  21. package/fesm/docs/index.js +58 -1
  22. package/fesm/dtos/index.js +280 -5
  23. package/fesm/entities/index.js +26 -46
  24. package/fesm/gateways/index.js +288 -1
  25. package/fesm/index.js +440 -9
  26. package/fesm/interfaces/index.js +16 -2
  27. package/fesm/modules/index.js +210 -1
  28. package/fesm/runtime.js +85 -0
  29. package/fesm/services/index.js +53 -8
  30. package/gateways/index.d.ts +1 -1
  31. package/gateways/task-board.gateway.d.ts +3 -3
  32. package/index.d.ts +9 -9
  33. package/interfaces/index.d.ts +2 -2
  34. package/interfaces/task-manager-module.interface.d.ts +3 -3
  35. package/interfaces/task.interface.d.ts +2 -2
  36. package/modules/index.d.ts +1 -1
  37. package/modules/task-manager.module.d.ts +2 -2
  38. package/package.json +26 -36
  39. package/services/index.d.ts +8 -8
  40. package/services/task-activity.service.d.ts +1 -1
  41. package/services/task-board.service.d.ts +5 -5
  42. package/services/task-comment.service.d.ts +4 -4
  43. package/services/task-label.service.d.ts +4 -4
  44. package/services/task-list.service.d.ts +4 -4
  45. package/services/task-manager-config.service.d.ts +3 -3
  46. package/services/task-manager-datasource.provider.d.ts +3 -3
  47. package/services/task.service.d.ts +7 -7
  48. package/cjs/config/event-actions.js +0 -37
  49. package/cjs/config/index.js +0 -20
  50. package/cjs/config/message-keys.js +0 -92
  51. package/cjs/config/task-manager.constants.js +0 -11
  52. package/cjs/controllers/index.js +0 -22
  53. package/cjs/controllers/task-board.controller.js +0 -219
  54. package/cjs/controllers/task-board.controller.spec.js +0 -132
  55. package/cjs/controllers/task-comment.controller.js +0 -103
  56. package/cjs/controllers/task-comment.controller.spec.js +0 -86
  57. package/cjs/controllers/task-label.controller.js +0 -112
  58. package/cjs/controllers/task-label.controller.spec.js +0 -88
  59. package/cjs/controllers/task-list.controller.js +0 -158
  60. package/cjs/controllers/task-list.controller.spec.js +0 -112
  61. package/cjs/controllers/task.controller.js +0 -199
  62. package/cjs/controllers/task.controller.spec.js +0 -131
  63. package/cjs/docs/index.js +0 -18
  64. package/cjs/docs/task-manager-swagger.config.js +0 -43
  65. package/cjs/docs/task-manager-swagger.config.spec.js +0 -28
  66. package/cjs/dtos/index.js +0 -22
  67. package/cjs/dtos/task-board.dto.js +0 -310
  68. package/cjs/dtos/task-comment.dto.js +0 -131
  69. package/cjs/dtos/task-label.dto.js +0 -120
  70. package/cjs/dtos/task-list.dto.js +0 -198
  71. package/cjs/dtos/task.dto.js +0 -367
  72. package/cjs/entities/index.js +0 -72
  73. package/cjs/entities/index.spec.js +0 -30
  74. package/cjs/entities/task-activity.entity.js +0 -98
  75. package/cjs/entities/task-assignee.entity.js +0 -67
  76. package/cjs/entities/task-board-member.entity.js +0 -94
  77. package/cjs/entities/task-board-with-company.entity.js +0 -57
  78. package/cjs/entities/task-board.entity.js +0 -88
  79. package/cjs/entities/task-comment.entity.js +0 -80
  80. package/cjs/entities/task-label.entity.js +0 -72
  81. package/cjs/entities/task-list.entity.js +0 -104
  82. package/cjs/entities/task-task-label.entity.js +0 -67
  83. package/cjs/entities/task.entity.js +0 -151
  84. package/cjs/gateways/index.js +0 -18
  85. package/cjs/gateways/task-board.gateway.js +0 -167
  86. package/cjs/gateways/task-board.gateway.spec.js +0 -243
  87. package/cjs/index.js +0 -26
  88. package/cjs/interfaces/index.js +0 -19
  89. package/cjs/interfaces/task-manager-module.interface.js +0 -4
  90. package/cjs/interfaces/task.interface.js +0 -4
  91. package/cjs/modules/index.js +0 -18
  92. package/cjs/modules/task-manager.module.js +0 -135
  93. package/cjs/modules/task-manager.module.spec.js +0 -144
  94. package/cjs/services/index.js +0 -25
  95. package/cjs/services/task-activity.service.js +0 -76
  96. package/cjs/services/task-activity.service.spec.js +0 -125
  97. package/cjs/services/task-board.service.js +0 -247
  98. package/cjs/services/task-board.service.spec.js +0 -465
  99. package/cjs/services/task-comment.service.js +0 -103
  100. package/cjs/services/task-comment.service.spec.js +0 -160
  101. package/cjs/services/task-label.service.js +0 -97
  102. package/cjs/services/task-label.service.spec.js +0 -138
  103. package/cjs/services/task-list.service.js +0 -130
  104. package/cjs/services/task-list.service.spec.js +0 -284
  105. package/cjs/services/task-manager-config.service.js +0 -69
  106. package/cjs/services/task-manager-config.service.spec.js +0 -98
  107. package/cjs/services/task-manager-datasource.provider.js +0 -84
  108. package/cjs/services/task-manager-datasource.provider.spec.js +0 -131
  109. package/cjs/services/task.service.js +0 -398
  110. package/cjs/services/task.service.spec.js +0 -700
  111. package/fesm/config/event-actions.js +0 -16
  112. package/fesm/config/message-keys.js +0 -65
  113. package/fesm/config/task-manager.constants.js +0 -1
  114. package/fesm/controllers/task-board.controller.js +0 -209
  115. package/fesm/controllers/task-board.controller.spec.js +0 -128
  116. package/fesm/controllers/task-comment.controller.js +0 -93
  117. package/fesm/controllers/task-comment.controller.spec.js +0 -82
  118. package/fesm/controllers/task-label.controller.js +0 -102
  119. package/fesm/controllers/task-label.controller.spec.js +0 -84
  120. package/fesm/controllers/task-list.controller.js +0 -148
  121. package/fesm/controllers/task-list.controller.spec.js +0 -108
  122. package/fesm/controllers/task.controller.js +0 -189
  123. package/fesm/controllers/task.controller.spec.js +0 -127
  124. package/fesm/docs/task-manager-swagger.config.js +0 -33
  125. package/fesm/docs/task-manager-swagger.config.spec.js +0 -24
  126. package/fesm/dtos/task-board.dto.js +0 -277
  127. package/fesm/dtos/task-comment.dto.js +0 -110
  128. package/fesm/dtos/task-label.dto.js +0 -99
  129. package/fesm/dtos/task-list.dto.js +0 -174
  130. package/fesm/dtos/task.dto.js +0 -337
  131. package/fesm/entities/index.spec.js +0 -26
  132. package/fesm/entities/task-activity.entity.js +0 -88
  133. package/fesm/entities/task-assignee.entity.js +0 -57
  134. package/fesm/entities/task-board-member.entity.js +0 -76
  135. package/fesm/entities/task-board-with-company.entity.js +0 -47
  136. package/fesm/entities/task-board.entity.js +0 -78
  137. package/fesm/entities/task-comment.entity.js +0 -70
  138. package/fesm/entities/task-label.entity.js +0 -62
  139. package/fesm/entities/task-list.entity.js +0 -94
  140. package/fesm/entities/task-task-label.entity.js +0 -57
  141. package/fesm/entities/task.entity.js +0 -133
  142. package/fesm/gateways/task-board.gateway.js +0 -157
  143. package/fesm/gateways/task-board.gateway.spec.js +0 -239
  144. package/fesm/interfaces/task-manager-module.interface.js +0 -1
  145. package/fesm/interfaces/task.interface.js +0 -1
  146. package/fesm/modules/task-manager.module.js +0 -125
  147. package/fesm/modules/task-manager.module.spec.js +0 -140
  148. package/fesm/services/task-activity.service.js +0 -66
  149. package/fesm/services/task-activity.service.spec.js +0 -121
  150. package/fesm/services/task-board.service.js +0 -237
  151. package/fesm/services/task-board.service.spec.js +0 -461
  152. package/fesm/services/task-comment.service.js +0 -93
  153. package/fesm/services/task-comment.service.spec.js +0 -156
  154. package/fesm/services/task-label.service.js +0 -87
  155. package/fesm/services/task-label.service.spec.js +0 -134
  156. package/fesm/services/task-list.service.js +0 -120
  157. package/fesm/services/task-list.service.spec.js +0 -280
  158. package/fesm/services/task-manager-config.service.js +0 -59
  159. package/fesm/services/task-manager-config.service.spec.js +0 -94
  160. package/fesm/services/task-manager-datasource.provider.js +0 -74
  161. package/fesm/services/task-manager-datasource.provider.spec.js +0 -127
  162. package/fesm/services/task.service.js +0 -388
  163. package/fesm/services/task.service.spec.js +0 -696
@@ -1,398 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "TaskService", {
6
- enumerable: true,
7
- get: function() {
8
- return TaskService;
9
- }
10
- });
11
- const _classes = require("@flusys/nestjs-shared/classes");
12
- const _modules = require("@flusys/nestjs-shared/modules");
13
- const _common = require("@nestjs/common");
14
- const _typeorm = require("typeorm");
15
- const _config = require("../config");
16
- const _entities = require("../entities");
17
- const _taskactivityservice = require("./task-activity.service");
18
- const _taskboardservice = require("./task-board.service");
19
- const _taskmanagerdatasourceprovider = require("./task-manager-datasource.provider");
20
- function _define_property(obj, key, value) {
21
- if (key in obj) {
22
- Object.defineProperty(obj, key, {
23
- value: value,
24
- enumerable: true,
25
- configurable: true,
26
- writable: true
27
- });
28
- } else {
29
- obj[key] = value;
30
- }
31
- return obj;
32
- }
33
- function _ts_decorate(decorators, target, key, desc) {
34
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
35
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
36
- else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
37
- return c > 3 && r && Object.defineProperty(target, key, r), r;
38
- }
39
- function _ts_metadata(k, v) {
40
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
41
- }
42
- function _ts_param(paramIndex, decorator) {
43
- return function(target, key) {
44
- decorator(target, key, paramIndex);
45
- };
46
- }
47
- let TaskService = class TaskService extends _classes.ApiService {
48
- /** Boards cache denormalized `total_tasks` / `total_lists`, so board caches go stale on any write here. */ async clearCacheForAll() {
49
- await super.clearCacheForAll();
50
- await this.utilsService.clearCache(_config.TASK_MANAGER_EVENT_ENTITIES.TASK_BOARD, this.cacheManager);
51
- }
52
- async convertSingleDtoToEntity(dto, user) {
53
- await this.ensureDataSourceRepository();
54
- let entity = {};
55
- if ('id' in dto && dto.id) {
56
- const existing = await this.repository.findOne({
57
- where: {
58
- id: dto.id
59
- }
60
- });
61
- if (!existing) throw new _common.NotFoundException({
62
- message: 'Task not found',
63
- messageKey: _config.TASK_MESSAGES.NOT_FOUND
64
- });
65
- entity = existing;
66
- }
67
- if (dto.assigneeIds?.length) {
68
- const boardId = dto.boardId ?? entity.boardId;
69
- const memberChecks = await Promise.all(dto.assigneeIds.map((id)=>this.boardService.isBoardMember(boardId, id)));
70
- if (memberChecks.some((isMember)=>!isMember)) {
71
- throw new _common.BadRequestException({
72
- message: 'Assignee is not a board member',
73
- messageKey: _config.TASK_MESSAGES.ASSIGNEE_NOT_BOARD_MEMBER
74
- });
75
- }
76
- }
77
- if ('labelIds' in dto && dto.labelIds !== undefined) {
78
- this.pendingLabelIds.push(dto.labelIds ?? []);
79
- }
80
- if ('assigneeIds' in dto && dto.assigneeIds !== undefined) {
81
- this.pendingAssigneeIds.push(dto.assigneeIds ?? []);
82
- } else {
83
- this.pendingAssigneeIds.push(undefined);
84
- }
85
- return {
86
- ...entity,
87
- boardId: dto.boardId ?? entity.boardId,
88
- listId: dto.listId ?? entity.listId,
89
- title: dto.title ?? entity.title,
90
- description: dto.description !== undefined ? dto.description ?? null : entity.description ?? null,
91
- priority: dto.priority ?? entity.priority ?? 'MEDIUM',
92
- dueDate: dto.dueDate !== undefined ? dto.dueDate ?? null : entity.dueDate ?? null,
93
- position: entity.position ?? 0,
94
- reporterId: entity.reporterId ?? user?.id ?? null,
95
- parentTaskId: dto.parentTaskId !== undefined ? dto.parentTaskId ?? null : entity.parentTaskId ?? null,
96
- estimatedHours: dto.estimatedHours !== undefined ? dto.estimatedHours ?? null : entity.estimatedHours ?? null
97
- };
98
- }
99
- async afterInsertOperation(entities, _dto, user, _qr) {
100
- await Promise.all(entities.map(async (entity, i)=>{
101
- const assigneeIds = this.pendingAssigneeIds[i] ?? [];
102
- const syncOps = [
103
- this.syncLabels(entity.id, this.pendingLabelIds[i] ?? [])
104
- ];
105
- if (assigneeIds.length > 0) {
106
- syncOps.push(this.syncAssignees(entity.id, assigneeIds));
107
- }
108
- await Promise.all(syncOps);
109
- }));
110
- await Promise.all([
111
- this.loadLabelsForTasks(entities),
112
- this.loadAssigneesForTasks(entities)
113
- ]);
114
- await Promise.all(entities.map((entity)=>this.activityService.log(entity.id, entity.boardId, user?.id ?? null, 'task.created', null, {
115
- title: entity.title
116
- })));
117
- this.pendingLabelIds = [];
118
- this.pendingAssigneeIds = [];
119
- }
120
- async afterUpdateOperation(entities, _dto, _user, _qr) {
121
- await Promise.all(entities.map(async (entity, i)=>{
122
- const syncOps = [];
123
- if (this.pendingLabelIds[i] !== undefined) {
124
- syncOps.push(this.syncLabels(entity.id, this.pendingLabelIds[i]));
125
- }
126
- if (this.pendingAssigneeIds[i] !== undefined) {
127
- syncOps.push(this.syncAssignees(entity.id, this.pendingAssigneeIds[i]));
128
- }
129
- if (syncOps.length > 0) await Promise.all(syncOps);
130
- }));
131
- await this.loadLabelsForTasks(entities);
132
- const entitiesWithAssigneeUpdates = entities.filter((_, i)=>this.pendingAssigneeIds[i] !== undefined);
133
- if (entitiesWithAssigneeUpdates.length > 0) {
134
- await this.loadAssigneesForTasks(entitiesWithAssigneeUpdates);
135
- }
136
- this.pendingLabelIds = [];
137
- this.pendingAssigneeIds = [];
138
- }
139
- async getFilterQuery(query, filter, _user) {
140
- for (const [key, value] of Object.entries(filter)){
141
- if (key === 'boardId') {
142
- query.andWhere('task.boardId = :boardId', {
143
- boardId: value
144
- });
145
- } else if (key === 'listId') {
146
- query.andWhere('task.listId = :listId', {
147
- listId: value
148
- });
149
- } else if (key === 'assigneeId') {
150
- query.innerJoin('task_assignee', 'ta', 'ta.task_id = task.id').andWhere('ta.user_id = :assigneeUserId', {
151
- assigneeUserId: value
152
- });
153
- } else if (key === 'priority') {
154
- query.andWhere('task.priority = :priority', {
155
- priority: value
156
- });
157
- }
158
- }
159
- return {
160
- query,
161
- isRaw: false
162
- };
163
- }
164
- async getAll(search, filterAndPaginationDto, user) {
165
- const result = await super.getAll(search, filterAndPaginationDto, user);
166
- await this.loadLabelsForTasks(result.data);
167
- await this.loadAssigneesForTasks(result.data);
168
- return result;
169
- }
170
- async moveTask(dto, user) {
171
- await this.ensureDataSourceRepository();
172
- const task = await this.repository.findOne({
173
- where: {
174
- id: dto.taskId,
175
- deletedAt: (0, _typeorm.IsNull)()
176
- }
177
- });
178
- if (!task) throw new _common.NotFoundException({
179
- message: 'Task not found',
180
- messageKey: _config.TASK_MESSAGES.NOT_FOUND
181
- });
182
- const oldListId = task.listId;
183
- task.listId = dto.targetListId;
184
- task.position = dto.position ?? 0;
185
- task.updatedById = user.id;
186
- const saved = await this.repository.save(task);
187
- await this.activityService.log(task.id, task.boardId, user.id, 'task.moved', {
188
- listId: oldListId
189
- }, {
190
- listId: dto.targetListId
191
- });
192
- await Promise.all([
193
- this.clearCacheForAll(),
194
- this.clearCacheForId([
195
- saved
196
- ])
197
- ]);
198
- await this.publishDomainAction(_config.TASK_MANAGER_EVENT_ACTIONS.MOVED, {
199
- ids: [
200
- saved.id
201
- ],
202
- metadata: {
203
- boardId: saved.boardId,
204
- fromListId: oldListId,
205
- toListId: dto.targetListId,
206
- position: saved.position
207
- },
208
- user
209
- });
210
- return saved;
211
- }
212
- async assignTask(dto, user) {
213
- await this.ensureDataSourceRepository();
214
- const task = await this.repository.findOne({
215
- where: {
216
- id: dto.taskId,
217
- deletedAt: (0, _typeorm.IsNull)()
218
- }
219
- });
220
- if (!task) throw new _common.NotFoundException({
221
- message: 'Task not found',
222
- messageKey: _config.TASK_MESSAGES.NOT_FOUND
223
- });
224
- const memberChecks = await Promise.all(dto.assigneeIds.map((id)=>this.boardService.isBoardMember(task.boardId, id)));
225
- if (memberChecks.some((isMember)=>!isMember)) {
226
- throw new _common.BadRequestException({
227
- message: 'Assignee is not a board member',
228
- messageKey: _config.TASK_MESSAGES.ASSIGNEE_NOT_BOARD_MEMBER
229
- });
230
- }
231
- const assigneeRepo = await this.ensureAssigneeRepository();
232
- const oldRows = await assigneeRepo.find({
233
- where: {
234
- taskId: dto.taskId
235
- }
236
- });
237
- const oldIds = oldRows.map((r)=>r.userId);
238
- await this.syncAssignees(dto.taskId, dto.assigneeIds);
239
- task.updatedById = user.id;
240
- const saved = await this.repository.save(task);
241
- await this.activityService.log(task.id, task.boardId, user.id, 'task.assigned', {
242
- assigneeIds: oldIds
243
- }, {
244
- assigneeIds: dto.assigneeIds
245
- });
246
- await Promise.all([
247
- this.clearCacheForAll(),
248
- this.clearCacheForId([
249
- saved
250
- ])
251
- ]);
252
- saved.assignees = await this.loadAssigneesForTask(saved.id);
253
- await this.publishDomainAction(_config.TASK_MANAGER_EVENT_ACTIONS.ASSIGNED, {
254
- ids: [
255
- saved.id
256
- ],
257
- metadata: {
258
- boardId: saved.boardId,
259
- previousAssigneeIds: oldIds,
260
- assigneeIds: dto.assigneeIds
261
- },
262
- user
263
- });
264
- return saved;
265
- }
266
- async syncAssignees(taskId, userIds) {
267
- const repo = await this.ensureAssigneeRepository();
268
- await repo.delete({
269
- taskId
270
- });
271
- if (userIds.length > 0) {
272
- await repo.save(userIds.map((userId)=>repo.create({
273
- taskId,
274
- userId
275
- })));
276
- }
277
- }
278
- async syncLabels(taskId, labelIds) {
279
- const labelRepo = await this.ensureLabelRepository();
280
- await labelRepo.delete({
281
- taskId
282
- });
283
- if (labelIds.length > 0) {
284
- const rows = labelIds.map((labelId)=>labelRepo.create({
285
- taskId,
286
- labelId
287
- }));
288
- await labelRepo.save(rows);
289
- }
290
- }
291
- async loadLabelsForTasks(tasks) {
292
- if (tasks.length === 0) return;
293
- const junctionRepo = await this.ensureLabelRepository();
294
- const fullRepo = await this.ensureFullLabelRepository();
295
- const taskIds = tasks.map((t)=>t.id);
296
- const junctionRows = await junctionRepo.find({
297
- where: {
298
- taskId: (0, _typeorm.In)(taskIds),
299
- deletedAt: (0, _typeorm.IsNull)()
300
- }
301
- });
302
- const uniqueLabelIds = [
303
- ...new Set(junctionRows.map((r)=>r.labelId))
304
- ];
305
- const fullLabels = uniqueLabelIds.length > 0 ? await fullRepo.find({
306
- where: {
307
- id: (0, _typeorm.In)(uniqueLabelIds),
308
- deletedAt: (0, _typeorm.IsNull)()
309
- }
310
- }) : [];
311
- const labelById = new Map(fullLabels.map((l)=>[
312
- l.id,
313
- l
314
- ]));
315
- const byTask = new Map();
316
- for (const row of junctionRows){
317
- const label = labelById.get(row.labelId);
318
- if (!label) continue;
319
- const list = byTask.get(row.taskId) ?? [];
320
- list.push(label);
321
- byTask.set(row.taskId, list);
322
- }
323
- for (const task of tasks){
324
- const taskLabels = byTask.get(task.id) ?? [];
325
- task.labelIds = taskLabels.map((l)=>l.id);
326
- task.labels = taskLabels;
327
- }
328
- }
329
- async loadAssigneesForTasks(tasks) {
330
- if (tasks.length === 0) return;
331
- const repo = await this.ensureAssigneeRepository();
332
- const taskIds = tasks.map((t)=>t.id);
333
- const rows = await repo.createQueryBuilder('ta').select('ta.task_id', 'taskId').addSelect('ta.user_id', 'userId').addSelect('u.name', 'userName').leftJoin('app_user', 'u', 'u.id = ta.user_id').where('ta.task_id IN (:...taskIds)', {
334
- taskIds
335
- }).getRawMany();
336
- const byTask = new Map();
337
- for (const row of rows){
338
- const list = byTask.get(row.taskId) ?? [];
339
- list.push({
340
- userId: row.userId,
341
- userName: row.userName ?? null
342
- });
343
- byTask.set(row.taskId, list);
344
- }
345
- for (const task of tasks){
346
- task.assignees = byTask.get(task.id) ?? [];
347
- }
348
- }
349
- async loadAssigneesForTask(taskId) {
350
- const repo = await this.ensureAssigneeRepository();
351
- const rows = await repo.createQueryBuilder('ta').select('ta.user_id', 'userId').addSelect('u.name', 'userName').leftJoin('app_user', 'u', 'u.id = ta.user_id').where('ta.task_id = :taskId', {
352
- taskId
353
- }).getRawMany();
354
- return rows.map((r)=>({
355
- userId: r.userId,
356
- userName: r.userName ?? null
357
- }));
358
- }
359
- async ensureLabelRepository() {
360
- if (!this.taskLabelRepository) {
361
- this.taskLabelRepository = await this.dataSourceProvider.getRepository(_entities.TaskTaskLabel);
362
- }
363
- return this.taskLabelRepository;
364
- }
365
- async ensureFullLabelRepository() {
366
- if (!this.fullLabelRepository) {
367
- this.fullLabelRepository = await this.dataSourceProvider.getRepository(_entities.TaskLabel);
368
- }
369
- return this.fullLabelRepository;
370
- }
371
- async ensureAssigneeRepository() {
372
- if (!this.taskAssigneeRepository) {
373
- this.taskAssigneeRepository = await this.dataSourceProvider.getRepository(_entities.TaskAssignee);
374
- }
375
- return this.taskAssigneeRepository;
376
- }
377
- constructor(cacheManager, utilsService, dataSourceProvider, boardService, activityService){
378
- super(_config.TASK_MANAGER_EVENT_ENTITIES.TASK, cacheManager, utilsService, TaskService.name, true, _config.TASK_MANAGER_EVENT_MODULE, dataSourceProvider, _entities.Task), _define_property(this, "cacheManager", void 0), _define_property(this, "utilsService", void 0), _define_property(this, "dataSourceProvider", void 0), _define_property(this, "boardService", void 0), _define_property(this, "activityService", void 0), _define_property(this, "taskLabelRepository", void 0), _define_property(this, "fullLabelRepository", void 0), _define_property(this, "taskAssigneeRepository", void 0), _define_property(this, "pendingLabelIds", void 0), _define_property(this, "pendingAssigneeIds", void 0), this.cacheManager = cacheManager, this.utilsService = utilsService, this.dataSourceProvider = dataSourceProvider, this.boardService = boardService, this.activityService = activityService, this.taskLabelRepository = null, this.fullLabelRepository = null, this.taskAssigneeRepository = null, this.pendingLabelIds = [], this.pendingAssigneeIds = [];
379
- }
380
- };
381
- TaskService = _ts_decorate([
382
- (0, _common.Injectable)({
383
- scope: _common.Scope.REQUEST
384
- }),
385
- _ts_param(0, (0, _common.Inject)('CACHE_INSTANCE')),
386
- _ts_param(1, (0, _common.Inject)(_modules.UtilsService)),
387
- _ts_param(2, (0, _common.Inject)(_taskmanagerdatasourceprovider.TaskManagerDataSourceProvider)),
388
- _ts_param(3, (0, _common.Inject)(_taskboardservice.TaskBoardService)),
389
- _ts_param(4, (0, _common.Inject)(_taskactivityservice.TaskActivityService)),
390
- _ts_metadata("design:type", Function),
391
- _ts_metadata("design:paramtypes", [
392
- typeof _classes.HybridCache === "undefined" ? Object : _classes.HybridCache,
393
- typeof _modules.UtilsService === "undefined" ? Object : _modules.UtilsService,
394
- typeof _taskmanagerdatasourceprovider.TaskManagerDataSourceProvider === "undefined" ? Object : _taskmanagerdatasourceprovider.TaskManagerDataSourceProvider,
395
- typeof _taskboardservice.TaskBoardService === "undefined" ? Object : _taskboardservice.TaskBoardService,
396
- typeof _taskactivityservice.TaskActivityService === "undefined" ? Object : _taskactivityservice.TaskActivityService
397
- ])
398
- ], TaskService);