|
|
|
@ -2,8 +2,9 @@ import { Inject, Injectable } from '@nestjs/common'
@@ -2,8 +2,9 @@ import { Inject, Injectable } from '@nestjs/common'
|
|
|
|
|
import * as _ from 'lodash' |
|
|
|
|
import * as moment from 'moment' |
|
|
|
|
import { $config } from 'src/config' |
|
|
|
|
import { Mailer, Tasks, Taxonomies, Users } from 'src/core' |
|
|
|
|
import { Factories, Mailer, Tasks, Taxonomies, Users } from 'src/core' |
|
|
|
|
import { |
|
|
|
|
FACTORIES_SERVICE, |
|
|
|
|
MAILER_SERVICE, |
|
|
|
|
TASKS_COMMENTS_SERVICE, |
|
|
|
|
TASKS_DOCUMENTS_SERVICE, |
|
|
|
@ -41,6 +42,7 @@ export class AppTasksService {
@@ -41,6 +42,7 @@ export class AppTasksService {
|
|
|
|
|
@Inject(TASKS_COMMENTS_SERVICE) |
|
|
|
|
private readonly tasksCommentsService: Tasks.ITasksCommentsService |
|
|
|
|
@Inject(MAILER_SERVICE) private readonly mailerService: Mailer.IMailerService |
|
|
|
|
@Inject(FACTORIES_SERVICE) private readonly factoriesService: Factories.IFactoriesService |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Метод для створення задач, створює окрему задачу для кожного з виконавців |
|
|
|
@ -155,6 +157,25 @@ export class AppTasksService {
@@ -155,6 +157,25 @@ export class AppTasksService {
|
|
|
|
|
[`${userId}`]: Tasks.Event.Read, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (taskForResponse.executor) { |
|
|
|
|
const factoriesIds = await this.usersService.getAllFactoriesIdsByUser( |
|
|
|
|
taskForResponse.executor.userId, |
|
|
|
|
) |
|
|
|
|
const factories = await this.factoriesService.getFactoriesByIds(factoriesIds) |
|
|
|
|
if (!_.isEmpty(factoriesIds)) { |
|
|
|
|
const factoriesNames = [] |
|
|
|
|
factoriesIds.map(it => { |
|
|
|
|
const factory = _.find(factories, factory => factory.id === it) |
|
|
|
|
factoriesNames.push(factory.name) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
taskForResponse.executor = { |
|
|
|
|
...taskForResponse.executor, |
|
|
|
|
factoryName: factoriesNames.join(', '), |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return taskForResponse |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|