@things-factory/organization 7.0.70 → 7.0.72
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.
- package/client/component/department-selector.ts +7 -2
- package/client/pages/employee/employee-list-page.ts +39 -5
- package/dist-client/component/department-selector.d.ts +1 -1
- package/dist-client/component/department-selector.js +6 -2
- package/dist-client/component/department-selector.js.map +1 -1
- package/dist-client/pages/employee/employee-list-page.d.ts +1 -0
- package/dist-client/pages/employee/employee-list-page.js +36 -5
- package/dist-client/pages/employee/employee-list-page.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/controllers/register-employee-as-system-user.d.ts +5 -1
- package/dist-server/controllers/register-employee-as-system-user.js +87 -35
- package/dist-server/controllers/register-employee-as-system-user.js.map +1 -1
- package/dist-server/service/employee/employee-mutation.d.ts +1 -1
- package/dist-server/service/employee/employee-mutation.js +68 -60
- package/dist-server/service/employee/employee-mutation.js.map +1 -1
- package/dist-server/service/employee/employee-query.d.ts +2 -2
- package/dist-server/service/employee/employee-query.js +18 -10
- package/dist-server/service/employee/employee-query.js.map +1 -1
- package/dist-server/service/index.d.ts +3 -3
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -6
- package/server/controllers/register-employee-as-system-user.ts +111 -37
- package/server/service/employee/employee-mutation.ts +83 -63
- package/server/service/employee/employee-query.ts +23 -12
- package/translations/en.json +5 -1
- package/translations/ja.json +5 -1
- package/translations/ko.json +5 -1
- package/translations/ms.json +4 -1
- package/translations/zh.json +5 -1
|
@@ -1 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { User } from '@things-factory/auth-base';
|
|
2
|
+
import { EmployeePatch } from 'service/employee/employee-type';
|
|
3
|
+
export declare function registerEmployeeAsSystemUser(employeeId: string, context: ResolverContext): Promise<Partial<User> & User>;
|
|
4
|
+
export declare function onUpdateEmployeeAsSystemUser(patch: EmployeePatch, context: ResolverContext): Promise<void>;
|
|
5
|
+
export declare function onDeleteEmployeeAsSystemUser(employeeId: string, context: ResolverContext): Promise<void>;
|
|
@@ -1,54 +1,106 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.registerEmployeeAsSystemUser = registerEmployeeAsSystemUser;
|
|
4
|
-
|
|
4
|
+
exports.onUpdateEmployeeAsSystemUser = onUpdateEmployeeAsSystemUser;
|
|
5
|
+
exports.onDeleteEmployeeAsSystemUser = onDeleteEmployeeAsSystemUser;
|
|
5
6
|
const shell_1 = require("@things-factory/shell");
|
|
6
|
-
const
|
|
7
|
+
const employee_1 = require("../service/employee/employee");
|
|
8
|
+
const contact_1 = require("@things-factory/contact");
|
|
9
|
+
const auth_base_1 = require("@things-factory/auth-base");
|
|
7
10
|
async function registerEmployeeAsSystemUser(employeeId, context) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
0. 이미 연결된 사용자가 없어야 한다.
|
|
12
|
-
1. contact 정보가 있어야 한다.
|
|
13
|
-
2. contact 정보에 대표 email 정보가 있어야 한다.
|
|
14
|
-
3. employee 의 직책 정보가 있어야 한다. => role 과 연결된다.
|
|
15
|
-
4. 사용자 중에서 동일한 이메일을 가진 사용자가 있는가 확인한다.
|
|
16
|
-
5. 그 사용자가 이 도메인에 연결되어 있는 지 확인한다. 없다면 실패.
|
|
17
|
-
6. 직책에 해당하는 역할이 있는 지 확인한다.
|
|
18
|
-
7. 시스템에 사용자를 등록한다.
|
|
19
|
-
8. 역할을 추가한다.
|
|
20
|
-
*/
|
|
21
|
-
const { domain, user } = context.state;
|
|
22
|
-
const employeeRepository = (0, shell_1.getRepository)(service_1.Employee);
|
|
11
|
+
const { domain, tx } = context.state;
|
|
12
|
+
const employeeRepository = (0, shell_1.getRepository)(employee_1.Employee, tx);
|
|
23
13
|
const employee = await employeeRepository.findOne({
|
|
24
14
|
where: {
|
|
25
15
|
id: employeeId,
|
|
26
16
|
domain: { id: domain.id }
|
|
27
17
|
},
|
|
28
|
-
relations: ['contact']
|
|
18
|
+
relations: ['contact', 'user']
|
|
29
19
|
});
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
20
|
+
if (employee.user) {
|
|
21
|
+
throw new Error(context.t('error.employee-already-registered'));
|
|
22
|
+
}
|
|
23
|
+
if (!employee.contact) {
|
|
24
|
+
throw new Error(context.t('error.contact-information-required'));
|
|
25
|
+
}
|
|
26
|
+
const systemUser = await (0, contact_1.registerContactAsSystemUser)({
|
|
27
|
+
contactId: employee.contact.id,
|
|
28
|
+
roleName: employee.active ? employee.jobResponsibility : ''
|
|
29
|
+
}, context);
|
|
30
|
+
employee.user = systemUser;
|
|
31
|
+
await employeeRepository.save(employee);
|
|
32
|
+
return systemUser;
|
|
33
|
+
}
|
|
34
|
+
async function onUpdateEmployeeAsSystemUser(patch, context) {
|
|
35
|
+
const { domain, user, tx } = context.state;
|
|
36
|
+
const { id, jobResponsibility } = patch;
|
|
37
|
+
const employeeRepository = (0, shell_1.getRepository)(employee_1.Employee, tx);
|
|
38
|
+
const employee = await employeeRepository.findOne({
|
|
34
39
|
where: {
|
|
35
|
-
|
|
40
|
+
id,
|
|
41
|
+
domain: { id: domain.id }
|
|
36
42
|
},
|
|
37
|
-
relations: ['
|
|
43
|
+
relations: ['contact', 'user']
|
|
38
44
|
});
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
if (!employee.user) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const { jobResponsibility: lastJobResponsibility } = employee;
|
|
49
|
+
if ('jobResponsibility' in patch && lastJobResponsibility !== jobResponsibility) {
|
|
50
|
+
const userRepository = (0, shell_1.getRepository)(auth_base_1.User, tx);
|
|
51
|
+
const systemUser = await userRepository.findOne({
|
|
52
|
+
where: { id: employee.user.id },
|
|
53
|
+
relations: ['domains', 'roles']
|
|
54
|
+
});
|
|
55
|
+
const { roles } = systemUser;
|
|
56
|
+
let newRoles = [...roles];
|
|
57
|
+
if (lastJobResponsibility) {
|
|
58
|
+
const lastRole = await (0, shell_1.getRepository)(auth_base_1.Role, tx).findOne({
|
|
59
|
+
where: { name: lastJobResponsibility, domain: { id: domain.id } }
|
|
60
|
+
});
|
|
61
|
+
if (lastRole) {
|
|
62
|
+
newRoles = roles.filter(role => role.id !== lastRole.id);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const newRole = await (0, shell_1.getRepository)(auth_base_1.Role, tx).findOne({
|
|
66
|
+
where: { name: jobResponsibility, domain: { id: domain.id } }
|
|
67
|
+
});
|
|
68
|
+
if (newRole && !roles.find(role => role.id === newRole.id)) {
|
|
69
|
+
newRoles = [...newRoles, newRole];
|
|
70
|
+
}
|
|
71
|
+
systemUser.roles = newRoles;
|
|
72
|
+
systemUser.updater = user;
|
|
73
|
+
await userRepository.save(systemUser);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
async function onDeleteEmployeeAsSystemUser(employeeId, context) {
|
|
77
|
+
const { domain, user, tx } = context.state;
|
|
78
|
+
const employeeRepository = (0, shell_1.getRepository)(employee_1.Employee, tx);
|
|
79
|
+
const employee = await employeeRepository.findOne({
|
|
46
80
|
where: {
|
|
47
|
-
|
|
81
|
+
id: employeeId,
|
|
48
82
|
domain: { id: domain.id }
|
|
49
|
-
}
|
|
83
|
+
},
|
|
84
|
+
relations: ['user']
|
|
50
85
|
});
|
|
51
|
-
|
|
52
|
-
|
|
86
|
+
if (!employee.user) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
const { jobResponsibility } = employee;
|
|
90
|
+
if (jobResponsibility) {
|
|
91
|
+
const userRepository = (0, shell_1.getRepository)(auth_base_1.User, tx);
|
|
92
|
+
const systemUser = await userRepository.findOne({
|
|
93
|
+
where: { id: employee.user.id },
|
|
94
|
+
relations: ['domains', 'roles']
|
|
95
|
+
});
|
|
96
|
+
const lastRole = await (0, shell_1.getRepository)(auth_base_1.Role, tx).findOne({
|
|
97
|
+
where: { name: jobResponsibility, domain: { id: domain.id } }
|
|
98
|
+
});
|
|
99
|
+
if (lastRole) {
|
|
100
|
+
systemUser.roles = systemUser.roles.filter(role => role.id !== lastRole.id);
|
|
101
|
+
systemUser.updater = user;
|
|
102
|
+
await userRepository.save(systemUser);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
53
105
|
}
|
|
54
106
|
//# sourceMappingURL=register-employee-as-system-user.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register-employee-as-system-user.js","sourceRoot":"","sources":["../../server/controllers/register-employee-as-system-user.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"register-employee-as-system-user.js","sourceRoot":"","sources":["../../server/controllers/register-employee-as-system-user.ts"],"names":[],"mappings":";;AAMA,oEAkCC;AAED,oEAsDC;AAED,oEAqCC;AAvID,iDAAqD;AACrD,2DAAuD;AACvD,qDAAqE;AACrE,yDAAsD;AAG/C,KAAK,UAAU,4BAA4B,CAAC,UAAkB,EAAE,OAAwB;IAC7F,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;IAEpC,MAAM,kBAAkB,GAAG,IAAA,qBAAa,EAAC,mBAAQ,EAAE,EAAE,CAAC,CAAA;IAEtD,MAAM,QAAQ,GAAG,MAAM,kBAAkB,CAAC,OAAO,CAAC;QAChD,KAAK,EAAE;YACL,EAAE,EAAE,UAAU;YACd,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE;SAC1B;QACD,SAAS,EAAE,CAAC,SAAS,EAAE,MAAM,CAAC;KAC/B,CAAC,CAAA;IAEF,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,mCAAmC,CAAC,CAAC,CAAA;IACjE,CAAC;IAED,IAAI,CAAC,QAAQ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AAA;QAEF,IAAI,QAAQ,EAAE,CAAC;YACb,UAAU,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,QAAQ,CAAC,EAAE,CAAC,CAAA;YAC3E,UAAU,CAAC,OAAO,GAAG,IAAI,CAAA;YACzB,MAAM,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;QACvC,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["import { getRepository } from '@things-factory/shell'\nimport { Employee } from '../service/employee/employee'\nimport { registerContactAsSystemUser } from '@things-factory/contact'\nimport { Role, User } from '@things-factory/auth-base'\nimport { EmployeePatch } from 'service/employee/employee-type'\n\nexport async function registerEmployeeAsSystemUser(employeeId: string, context: ResolverContext) {\n const { domain, tx } = context.state\n\n const employeeRepository = getRepository(Employee, tx)\n\n const employee = await employeeRepository.findOne({\n where: {\n id: employeeId,\n domain: { id: domain.id }\n },\n relations: ['contact', 'user']\n })\n\n if (employee.user) {\n throw new Error(context.t('error.employee-already-registered'))\n }\n\n if (!employee.contact) {\n throw new Error(context.t('error.contact-information-required'))\n }\n\n const systemUser = await registerContactAsSystemUser(\n {\n contactId: employee.contact.id,\n roleName: employee.active ? employee.jobResponsibility : ''\n },\n context\n )\n\n employee.user = systemUser\n\n await employeeRepository.save(employee)\n\n return systemUser\n}\n\nexport async function onUpdateEmployeeAsSystemUser(patch: EmployeePatch, context: ResolverContext) {\n const { domain, user, tx } = context.state\n const { id, jobResponsibility } = patch\n\n const employeeRepository = getRepository(Employee, tx)\n\n const employee = await employeeRepository.findOne({\n where: {\n id,\n domain: { id: domain.id }\n },\n relations: ['contact', 'user']\n })\n\n if (!employee.user) {\n return\n }\n\n const { jobResponsibility: lastJobResponsibility } = employee\n\n if ('jobResponsibility' in patch && lastJobResponsibility !== jobResponsibility) {\n const userRepository = getRepository(User, tx)\n\n const systemUser = await userRepository.findOne({\n where: { id: employee.user.id },\n relations: ['domains', 'roles']\n })\n\n const { roles } = systemUser\n let newRoles = [...roles]\n\n if (lastJobResponsibility) {\n const lastRole = await getRepository(Role, tx).findOne({\n where: { name: lastJobResponsibility, domain: { id: domain.id } }\n })\n\n if (lastRole) {\n newRoles = roles.filter(role => role.id !== lastRole.id)\n }\n }\n\n const newRole = await getRepository(Role, tx).findOne({\n where: { name: jobResponsibility, domain: { id: domain.id } }\n })\n\n if (newRole && !roles.find(role => role.id === newRole.id)) {\n newRoles = [...newRoles, newRole]\n }\n\n systemUser.roles = newRoles\n systemUser.updater = user\n\n await userRepository.save(systemUser)\n }\n}\n\nexport async function onDeleteEmployeeAsSystemUser(employeeId: string, context: ResolverContext) {\n const { domain, user, tx } = context.state\n\n const employeeRepository = getRepository(Employee, tx)\n\n const employee = await employeeRepository.findOne({\n where: {\n id: employeeId,\n domain: { id: domain.id }\n },\n relations: ['user']\n })\n\n if (!employee.user) {\n return\n }\n\n const { jobResponsibility } = employee\n\n if (jobResponsibility) {\n const userRepository = getRepository(User, tx)\n\n const systemUser = await userRepository.findOne({\n where: { id: employee.user.id },\n relations: ['domains', 'roles']\n })\n\n const lastRole = await getRepository(Role, tx).findOne({\n where: { name: jobResponsibility, domain: { id: domain.id } }\n })\n\n if (lastRole) {\n systemUser.roles = systemUser.roles.filter(role => role.id !== lastRole.id)\n systemUser.updater = user\n await userRepository.save(systemUser)\n }\n }\n}\n"]}
|
|
@@ -9,5 +9,5 @@ export declare class EmployeeMutation {
|
|
|
9
9
|
importEmployees(employees: EmployeePatch[], context: ResolverContext): Promise<boolean>;
|
|
10
10
|
attachContact(id: string, contactId: string, context: ResolverContext): Promise<Employee>;
|
|
11
11
|
detachContact(id: string, context: ResolverContext): Promise<Employee>;
|
|
12
|
-
registerEmployeeAsSystemUser(
|
|
12
|
+
registerEmployeeAsSystemUser(employeeId: string, context: ResolverContext): Promise<boolean>;
|
|
13
13
|
}
|
|
@@ -4,25 +4,27 @@ exports.EmployeeMutation = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const type_graphql_1 = require("type-graphql");
|
|
6
6
|
const typeorm_1 = require("typeorm");
|
|
7
|
+
const shell_1 = require("@things-factory/shell");
|
|
7
8
|
const auth_base_1 = require("@things-factory/auth-base");
|
|
8
9
|
const attachment_base_1 = require("@things-factory/attachment-base");
|
|
9
10
|
const contact_1 = require("@things-factory/contact");
|
|
10
11
|
const employee_1 = require("./employee");
|
|
11
12
|
const employee_type_1 = require("./employee-type");
|
|
12
13
|
const department_1 = require("../department/department");
|
|
14
|
+
const register_employee_as_system_user_1 = require("../../controllers/register-employee-as-system-user");
|
|
13
15
|
let EmployeeMutation = class EmployeeMutation {
|
|
14
16
|
async createEmployee(employee, context) {
|
|
15
17
|
const { domain, user, tx } = context.state;
|
|
16
18
|
const supervisor = 'supervisor' in employee
|
|
17
|
-
? employee.supervisor && (await
|
|
19
|
+
? employee.supervisor && (await (0, shell_1.getRepository)(employee_1.Employee, tx).findOneBy({ id: employee.supervisor.id }))
|
|
18
20
|
: undefined;
|
|
19
21
|
const department = 'department' in employee
|
|
20
|
-
? employee.department && (await
|
|
22
|
+
? employee.department && (await (0, shell_1.getRepository)(department_1.Department, tx).findOneBy({ id: employee.department.id }))
|
|
21
23
|
: undefined;
|
|
22
24
|
const connectedUser = 'user' in employee
|
|
23
|
-
? employee.user && (await
|
|
25
|
+
? employee.user && (await (0, shell_1.getRepository)(auth_base_1.User, tx).findOneBy({ id: employee.user.id }))
|
|
24
26
|
: undefined;
|
|
25
|
-
const result = await
|
|
27
|
+
const result = await (0, shell_1.getRepository)(employee_1.Employee, tx).save(Object.assign(Object.assign({}, employee), { supervisor,
|
|
26
28
|
department, user: connectedUser, domain, creator: user, updater: user }));
|
|
27
29
|
if (employee.photo) {
|
|
28
30
|
await (0, attachment_base_1.createAttachment)(null, {
|
|
@@ -38,16 +40,17 @@ let EmployeeMutation = class EmployeeMutation {
|
|
|
38
40
|
async updateEmployee(id, patch, context) {
|
|
39
41
|
const { domain, user, tx } = context.state;
|
|
40
42
|
const supervisor = 'supervisor' in patch
|
|
41
|
-
? patch.supervisor && (await
|
|
43
|
+
? patch.supervisor && (await (0, shell_1.getRepository)(employee_1.Employee, tx).findOneBy({ id: patch.supervisor.id }))
|
|
42
44
|
: undefined;
|
|
43
45
|
const department = 'department' in patch
|
|
44
|
-
? patch.department && (await
|
|
46
|
+
? patch.department && (await (0, shell_1.getRepository)(department_1.Department, tx).findOneBy({ id: patch.department.id }))
|
|
45
47
|
: undefined;
|
|
46
|
-
const connectedUser = 'user' in patch ? patch.user && (await
|
|
47
|
-
const repository =
|
|
48
|
+
const connectedUser = 'user' in patch ? patch.user && (await (0, shell_1.getRepository)(auth_base_1.User, tx).findOneBy({ id: patch.user.id })) : undefined;
|
|
49
|
+
const repository = (0, shell_1.getRepository)(employee_1.Employee, tx);
|
|
48
50
|
const employee = await repository.findOne({
|
|
49
51
|
where: { domain: { id: domain.id }, id }
|
|
50
52
|
});
|
|
53
|
+
(0, register_employee_as_system_user_1.onUpdateEmployeeAsSystemUser)(patch, context);
|
|
51
54
|
const result = await repository.save(Object.assign(Object.assign(Object.assign({}, employee), patch), { supervisor,
|
|
52
55
|
department, user: connectedUser, updater: user }));
|
|
53
56
|
if (patch.photo) {
|
|
@@ -67,18 +70,18 @@ let EmployeeMutation = class EmployeeMutation {
|
|
|
67
70
|
let results = [];
|
|
68
71
|
const _createRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === '+');
|
|
69
72
|
const _updateRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === 'M');
|
|
70
|
-
const employeeRepo =
|
|
73
|
+
const employeeRepo = (0, shell_1.getRepository)(employee_1.Employee, tx);
|
|
71
74
|
if (_createRecords.length > 0) {
|
|
72
75
|
for (let i = 0; i < _createRecords.length; i++) {
|
|
73
76
|
const newRecord = _createRecords[i];
|
|
74
77
|
const supervisor = 'supervisor' in newRecord
|
|
75
|
-
? newRecord.supervisor && (await
|
|
78
|
+
? newRecord.supervisor && (await (0, shell_1.getRepository)(employee_1.Employee, tx).findOneBy({ id: newRecord.supervisor.id }))
|
|
76
79
|
: undefined;
|
|
77
80
|
const department = 'department' in newRecord
|
|
78
|
-
? newRecord.department && (await
|
|
81
|
+
? newRecord.department && (await (0, shell_1.getRepository)(department_1.Department, tx).findOneBy({ id: newRecord.department.id }))
|
|
79
82
|
: undefined;
|
|
80
83
|
const connectedUser = 'user' in newRecord
|
|
81
|
-
? newRecord.user && (await
|
|
84
|
+
? newRecord.user && (await (0, shell_1.getRepository)(auth_base_1.User, tx).findOneBy({ id: newRecord.user.id }))
|
|
82
85
|
: undefined;
|
|
83
86
|
const result = await employeeRepo.save(Object.assign(Object.assign({}, newRecord), { supervisor,
|
|
84
87
|
department, user: connectedUser, domain, creator: user, updater: user }));
|
|
@@ -99,16 +102,17 @@ let EmployeeMutation = class EmployeeMutation {
|
|
|
99
102
|
const updateRecord = _updateRecords[i];
|
|
100
103
|
const supervisor = 'supervisor' in updateRecord
|
|
101
104
|
? updateRecord.supervisor &&
|
|
102
|
-
(await
|
|
105
|
+
(await (0, shell_1.getRepository)(employee_1.Employee, tx).findOneBy({ id: updateRecord.supervisor.id }))
|
|
103
106
|
: undefined;
|
|
104
107
|
const department = 'department' in updateRecord
|
|
105
108
|
? updateRecord.department &&
|
|
106
|
-
(await
|
|
109
|
+
(await (0, shell_1.getRepository)(department_1.Department, tx).findOneBy({ id: updateRecord.department.id }))
|
|
107
110
|
: undefined;
|
|
108
111
|
const connectedUser = 'user' in updateRecord
|
|
109
|
-
? updateRecord.user && (await
|
|
112
|
+
? updateRecord.user && (await (0, shell_1.getRepository)(auth_base_1.User, tx).findOneBy({ id: updateRecord.user.id }))
|
|
110
113
|
: undefined;
|
|
111
114
|
const employee = await employeeRepo.findOneBy({ id: updateRecord.id });
|
|
115
|
+
(0, register_employee_as_system_user_1.onUpdateEmployeeAsSystemUser)(updateRecord, context);
|
|
112
116
|
const result = await employeeRepo.save(Object.assign(Object.assign(Object.assign({}, employee), updateRecord), { supervisor,
|
|
113
117
|
department, user: connectedUser, updater: user }));
|
|
114
118
|
if (updateRecord.photo) {
|
|
@@ -128,13 +132,17 @@ let EmployeeMutation = class EmployeeMutation {
|
|
|
128
132
|
}
|
|
129
133
|
async deleteEmployee(id, context) {
|
|
130
134
|
const { domain, tx } = context.state;
|
|
131
|
-
|
|
135
|
+
(0, register_employee_as_system_user_1.onDeleteEmployeeAsSystemUser)(id, context);
|
|
136
|
+
await (0, shell_1.getRepository)(employee_1.Employee, tx).delete({ domain: { id: domain.id }, id });
|
|
132
137
|
await (0, attachment_base_1.deleteAttachmentsByRef)(null, { refBys: [id] }, context);
|
|
133
138
|
return true;
|
|
134
139
|
}
|
|
135
140
|
async deleteEmployees(ids, context) {
|
|
136
141
|
const { domain, tx } = context.state;
|
|
137
|
-
|
|
142
|
+
for (let id of ids) {
|
|
143
|
+
(0, register_employee_as_system_user_1.onDeleteEmployeeAsSystemUser)(id, context);
|
|
144
|
+
}
|
|
145
|
+
await (0, shell_1.getRepository)(employee_1.Employee, tx).delete({
|
|
138
146
|
domain: { id: domain.id },
|
|
139
147
|
id: (0, typeorm_1.In)(ids)
|
|
140
148
|
});
|
|
@@ -144,17 +152,17 @@ let EmployeeMutation = class EmployeeMutation {
|
|
|
144
152
|
async importEmployees(employees, context) {
|
|
145
153
|
const { domain, tx } = context.state;
|
|
146
154
|
await Promise.all(employees.map(async (employee) => {
|
|
147
|
-
const createdEmployee = await
|
|
155
|
+
const createdEmployee = await (0, shell_1.getRepository)(employee_1.Employee, tx).save(Object.assign({ domain }, employee));
|
|
148
156
|
}));
|
|
149
157
|
return true;
|
|
150
158
|
}
|
|
151
159
|
async attachContact(id, contactId, context) {
|
|
152
160
|
const { domain, user, tx } = context.state;
|
|
153
|
-
const employeeRepository =
|
|
161
|
+
const employeeRepository = (0, shell_1.getRepository)(employee_1.Employee, tx);
|
|
154
162
|
const employee = await employeeRepository.findOne({
|
|
155
163
|
where: { domain: { id: domain.id }, id }
|
|
156
164
|
});
|
|
157
|
-
const contactRepository =
|
|
165
|
+
const contactRepository = (0, shell_1.getRepository)(contact_1.Contact, tx);
|
|
158
166
|
const contact = await contactRepository.findOne({
|
|
159
167
|
where: { domain: { id: domain.id }, id: contactId }
|
|
160
168
|
});
|
|
@@ -166,48 +174,24 @@ let EmployeeMutation = class EmployeeMutation {
|
|
|
166
174
|
}
|
|
167
175
|
async detachContact(id, context) {
|
|
168
176
|
const { domain, user, tx } = context.state;
|
|
169
|
-
const repository =
|
|
177
|
+
const repository = (0, shell_1.getRepository)(employee_1.Employee, tx);
|
|
170
178
|
const employee = await repository.findOne({
|
|
171
179
|
where: { domain: { id: domain.id }, id }
|
|
172
180
|
});
|
|
173
181
|
const result = await repository.save(Object.assign(Object.assign({}, employee), { contact: null, updater: user }));
|
|
174
182
|
return result;
|
|
175
183
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
const { domain, user, tx } = context.state;
|
|
179
|
-
const employeeRepository = tx.getRepository(employee_1.Employee);
|
|
180
|
-
const employee = await employeeRepository.findOne({
|
|
181
|
-
where: { domain: { id: domain.id }, id },
|
|
182
|
-
relations: ['contact', 'user']
|
|
183
|
-
});
|
|
184
|
-
return true;
|
|
185
|
-
/*
|
|
186
|
-
process
|
|
187
|
-
|
|
188
|
-
0. 이미 연결된 사용자가 없어야 한다.
|
|
189
|
-
1. contact 정보가 있어야 한다.
|
|
190
|
-
2. contact 정보에 대표 email 정보가 있어야 한다.
|
|
191
|
-
3. employee 의 직책 정보가 있어야 한다. => role 과 연결된다.
|
|
192
|
-
4. 사용자 중에서 동일한 이메일을 가진 사용자가 있는가 확인한다.
|
|
193
|
-
5. 그 사용자가 이 도메인에 연결되어 있는 지 확인한다. 없다면 실패.
|
|
194
|
-
6. 직책에 해당하는 역할이 있는 지 확인한다.
|
|
195
|
-
7. 시스템에 사용자를 등록한다.
|
|
196
|
-
8. 역할을 추가한다.
|
|
197
|
-
*/
|
|
198
|
-
// const result = await employeeRepository.save({
|
|
199
|
-
// ...employee,
|
|
200
|
-
// name: contact.name,
|
|
201
|
-
// contact: { id: contactId },
|
|
202
|
-
// updater: user
|
|
203
|
-
// })
|
|
204
|
-
// return result
|
|
184
|
+
async registerEmployeeAsSystemUser(employeeId, context) {
|
|
185
|
+
return !!(0, register_employee_as_system_user_1.registerEmployeeAsSystemUser)(employeeId, context);
|
|
205
186
|
}
|
|
206
187
|
};
|
|
207
188
|
exports.EmployeeMutation = EmployeeMutation;
|
|
208
189
|
tslib_1.__decorate([
|
|
209
190
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
210
|
-
(0, type_graphql_1.
|
|
191
|
+
(0, type_graphql_1.Directive)('@privilege(category: "employee", privilege: "mutation", domainOwnerGranted: true)'),
|
|
192
|
+
(0, type_graphql_1.Mutation)(returns => employee_1.Employee, {
|
|
193
|
+
description: 'Creates a new employee record with the provided details. Optionally associates the employee with a supervisor, department, and system user. If a photo is provided, it will be attached to the employee record.'
|
|
194
|
+
}),
|
|
211
195
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('employee')),
|
|
212
196
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
213
197
|
tslib_1.__metadata("design:type", Function),
|
|
@@ -216,7 +200,10 @@ tslib_1.__decorate([
|
|
|
216
200
|
], EmployeeMutation.prototype, "createEmployee", null);
|
|
217
201
|
tslib_1.__decorate([
|
|
218
202
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
219
|
-
(0, type_graphql_1.
|
|
203
|
+
(0, type_graphql_1.Directive)('@privilege(category: "employee", privilege: "mutation", domainOwnerGranted: true)'),
|
|
204
|
+
(0, type_graphql_1.Mutation)(returns => employee_1.Employee, {
|
|
205
|
+
description: 'Updates the details of an existing employee identified by the given ID. Optionally updates the supervisor, department, system user, and photo associated with the employee.'
|
|
206
|
+
}),
|
|
220
207
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
221
208
|
tslib_1.__param(1, (0, type_graphql_1.Arg)('patch')),
|
|
222
209
|
tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
|
|
@@ -226,7 +213,10 @@ tslib_1.__decorate([
|
|
|
226
213
|
], EmployeeMutation.prototype, "updateEmployee", null);
|
|
227
214
|
tslib_1.__decorate([
|
|
228
215
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
229
|
-
(0, type_graphql_1.
|
|
216
|
+
(0, type_graphql_1.Directive)('@privilege(category: "employee", privilege: "mutation", domainOwnerGranted: true)'),
|
|
217
|
+
(0, type_graphql_1.Mutation)(returns => [employee_1.Employee], {
|
|
218
|
+
description: 'Updates or creates multiple employee records based on the provided patches. New employees are created if the "cuFlag" is "+", and existing employees are updated if the "cuFlag" is "M".'
|
|
219
|
+
}),
|
|
230
220
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [employee_type_1.EmployeePatch])),
|
|
231
221
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
232
222
|
tslib_1.__metadata("design:type", Function),
|
|
@@ -235,7 +225,10 @@ tslib_1.__decorate([
|
|
|
235
225
|
], EmployeeMutation.prototype, "updateMultipleEmployee", null);
|
|
236
226
|
tslib_1.__decorate([
|
|
237
227
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
238
|
-
(0, type_graphql_1.
|
|
228
|
+
(0, type_graphql_1.Directive)('@privilege(category: "employee", privilege: "mutation", domainOwnerGranted: true)'),
|
|
229
|
+
(0, type_graphql_1.Mutation)(returns => Boolean, {
|
|
230
|
+
description: 'Deletes an employee record identified by the given ID. Also deletes any attachments associated with the employee.'
|
|
231
|
+
}),
|
|
239
232
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
240
233
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
241
234
|
tslib_1.__metadata("design:type", Function),
|
|
@@ -244,7 +237,10 @@ tslib_1.__decorate([
|
|
|
244
237
|
], EmployeeMutation.prototype, "deleteEmployee", null);
|
|
245
238
|
tslib_1.__decorate([
|
|
246
239
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
247
|
-
(0, type_graphql_1.
|
|
240
|
+
(0, type_graphql_1.Directive)('@privilege(category: "employee", privilege: "mutation", domainOwnerGranted: true)'),
|
|
241
|
+
(0, type_graphql_1.Mutation)(returns => Boolean, {
|
|
242
|
+
description: 'Deletes multiple employee records identified by the given IDs. Also deletes any attachments associated with each employee.'
|
|
243
|
+
}),
|
|
248
244
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
|
|
249
245
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
250
246
|
tslib_1.__metadata("design:type", Function),
|
|
@@ -253,7 +249,10 @@ tslib_1.__decorate([
|
|
|
253
249
|
], EmployeeMutation.prototype, "deleteEmployees", null);
|
|
254
250
|
tslib_1.__decorate([
|
|
255
251
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
256
|
-
(0, type_graphql_1.
|
|
252
|
+
(0, type_graphql_1.Directive)('@privilege(category: "employee", privilege: "mutation", domainOwnerGranted: true)'),
|
|
253
|
+
(0, type_graphql_1.Mutation)(returns => Boolean, {
|
|
254
|
+
description: 'Imports multiple employee records into the system. Each employee record must be provided in the EmployeePatch format.'
|
|
255
|
+
}),
|
|
257
256
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('employees', type => [employee_type_1.EmployeePatch])),
|
|
258
257
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
259
258
|
tslib_1.__metadata("design:type", Function),
|
|
@@ -262,7 +261,10 @@ tslib_1.__decorate([
|
|
|
262
261
|
], EmployeeMutation.prototype, "importEmployees", null);
|
|
263
262
|
tslib_1.__decorate([
|
|
264
263
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
265
|
-
(0, type_graphql_1.
|
|
264
|
+
(0, type_graphql_1.Directive)('@privilege(category: "employee", privilege: "mutation", domainOwnerGranted: true)'),
|
|
265
|
+
(0, type_graphql_1.Mutation)(returns => employee_1.Employee, {
|
|
266
|
+
description: 'Attaches an existing contact to an employee. The contact is identified by its ID and the employee is identified by their ID.'
|
|
267
|
+
}),
|
|
266
268
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
267
269
|
tslib_1.__param(1, (0, type_graphql_1.Arg)('contactId')),
|
|
268
270
|
tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
|
|
@@ -272,7 +274,10 @@ tslib_1.__decorate([
|
|
|
272
274
|
], EmployeeMutation.prototype, "attachContact", null);
|
|
273
275
|
tslib_1.__decorate([
|
|
274
276
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
275
|
-
(0, type_graphql_1.
|
|
277
|
+
(0, type_graphql_1.Directive)('@privilege(category: "employee", privilege: "mutation", domainOwnerGranted: true)'),
|
|
278
|
+
(0, type_graphql_1.Mutation)(returns => employee_1.Employee, {
|
|
279
|
+
description: 'Detaches an existing contact from an employee. The employee is identified by their ID.'
|
|
280
|
+
}),
|
|
276
281
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
277
282
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
278
283
|
tslib_1.__metadata("design:type", Function),
|
|
@@ -281,8 +286,11 @@ tslib_1.__decorate([
|
|
|
281
286
|
], EmployeeMutation.prototype, "detachContact", null);
|
|
282
287
|
tslib_1.__decorate([
|
|
283
288
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
284
|
-
(0, type_graphql_1.
|
|
285
|
-
|
|
289
|
+
(0, type_graphql_1.Directive)('@privilege(category: "user", privilege: "mutation", domainOwnerGranted: true)'),
|
|
290
|
+
(0, type_graphql_1.Mutation)(returns => Boolean, {
|
|
291
|
+
description: 'Registers an existing employee as a system user, granting them access to the system. The employee is identified by their ID.'
|
|
292
|
+
}),
|
|
293
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('employeeId', { description: 'Employee Id' })),
|
|
286
294
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
287
295
|
tslib_1.__metadata("design:type", Function),
|
|
288
296
|
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"employee-mutation.js","sourceRoot":"","sources":["../../../server/service/employee/employee-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,yDAAgD;AAChD,qEAA0F;AAC1F,qDAAiD;AAEjD,yCAAqC;AACrC,mDAA4D;AAC5D,yDAAqD;AAG9C,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAGrB,AAAN,KAAK,CAAC,cAAc,CAAkB,QAAqB,EAAS,OAAwB;QAC1F,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,UAAU,GACd,YAAY,IAAI,QAAQ;YACtB,CAAC,CAAC,QAAQ,CAAC,UAAU,IAAI,CAAC,MAAM,EAAE,CAAC,aAAa,CAAC,mBAAQ,CAAC,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC;YACrG,CAAC,CAAC,SAAS,CAAA;QAEf,MAAM,UAAU,GACd,YAAY,IAAI,QAAQ;YACtB,CAAC,CAAC,QAAQ,CAAC,UAAU,IAAI,CAAC,MAAM,EAAE,CAAC,aAAa,CAAC,uBAAU,CAAC,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC;YACvG,CAAC,CAAC,SAAS,CAAA;QAEf,MAAM,aAAa,GACjB,MAAM,IAAI,QAAQ;YAChB,CAAC,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,aAAa,CAAC,gBAAI,CAAC,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;YACrF,CAAC,CAAC,SAAS,CAAA;QAEf,MAA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AAE,CAAC,CAAC,6BAAa,CAAC,CAAC,CAAA;IACzC,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;uDAWP;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,mBAAQ,EAAE,EAAE,WAAW,EAAE,iCAAiC,EAAE,CAAC;IAE/E,mBAAA,IAAA,kBAAG,EAAC,IAAI,CAAC,CAAA;IACT,mBAAA,IAAA,kBAAG,EAAC,WAAW,CAAC,CAAA;IAChB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;qDA0BP;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,mBAAQ,EAAE,EAAE,WAAW,EAAE,mCAAmC,EAAE,CAAC;IAC/D,mBAAA,IAAA,kBAAG,EAAC,IAAI,CAAC,CAAA;IAAc,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;qDAehD;AAKK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,uCAAuC,EAAE,CAAC;IAEpF,mBAAA,IAAA,kBAAG,EAAC,IAAI,EAAE,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC,CAAA;IACzC,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;oEAiCP;2BAhWU,gBAAgB;IAD5B,IAAA,uBAAQ,EAAC,mBAAQ,CAAC;GACN,gBAAgB,CAiW5B","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { User } from '@things-factory/auth-base'\nimport { createAttachment, deleteAttachmentsByRef } from '@things-factory/attachment-base'\nimport { Contact } from '@things-factory/contact'\n\nimport { Employee } from './employee'\nimport { NewEmployee, EmployeePatch } from './employee-type'\nimport { Department } from '../department/department'\n\n@Resolver(Employee)\nexport class EmployeeMutation {\n @Directive('@transaction')\n @Mutation(returns => Employee, { description: 'To create new Employee' })\n async createEmployee(@Arg('employee') employee: NewEmployee, @Ctx() context: ResolverContext): Promise<Employee> {\n const { domain, user, tx } = context.state\n\n const supervisor =\n 'supervisor' in employee\n ? employee.supervisor && (await tx.getRepository(Employee).findOneBy({ id: employee.supervisor.id }))\n : undefined\n\n const department =\n 'department' in employee\n ? employee.department && (await tx.getRepository(Department).findOneBy({ id: employee.department.id }))\n : undefined\n\n const connectedUser =\n 'user' in employee\n ? employee.user && (await tx.getRepository(User).findOneBy({ id: employee.user.id }))\n : undefined\n\n const result = await tx.getRepository(Employee).save({\n ...employee,\n supervisor,\n department,\n user: connectedUser,\n domain,\n creator: user,\n updater: user\n })\n\n if (employee.photo) {\n await createAttachment(\n null,\n {\n attachment: {\n file: employee.photo,\n refType: Employee.name,\n refBy: result.id\n }\n },\n context\n )\n }\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => Employee, { description: 'To modify Employee information' })\n async updateEmployee(\n @Arg('id') id: string,\n @Arg('patch') patch: EmployeePatch,\n @Ctx() context: ResolverContext\n ): Promise<Employee> {\n const { domain, user, tx } = context.state\n\n const supervisor =\n 'supervisor' in patch\n ? patch.supervisor && (await tx.getRepository(Employee).findOneBy({ id: patch.supervisor.id }))\n : undefined\n\n const department =\n 'department' in patch\n ? patch.department && (await tx.getRepository(Department).findOneBy({ id: patch.department.id }))\n : undefined\n\n const connectedUser =\n 'user' in patch ? patch.user && (await tx.getRepository(User).findOneBy({ id: patch.user.id })) : undefined\n\n const repository = tx.getRepository(Employee)\n const employee = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const result = await repository.save({\n ...employee,\n ...patch,\n supervisor,\n department,\n user: connectedUser,\n updater: user\n })\n\n if (patch.photo) {\n await deleteAttachmentsByRef(null, { refBys: [result.id] }, context)\n await createAttachment(\n null,\n {\n attachment: {\n file: patch.photo,\n refType: Employee.name,\n refBy: result.id\n }\n },\n context\n )\n }\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => [Employee], { description: \"To modify multiple Employees' information\" })\n async updateMultipleEmployee(\n @Arg('patches', type => [EmployeePatch]) patches: EmployeePatch[],\n @Ctx() context: ResolverContext\n ): Promise<Employee[]> {\n const { domain, user, tx } = context.state\n\n let results = []\n const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')\n const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')\n const employeeRepo = tx.getRepository(Employee)\n\n if (_createRecords.length > 0) {\n for (let i = 0; i < _createRecords.length; i++) {\n const newRecord = _createRecords[i]\n\n const supervisor =\n 'supervisor' in newRecord\n ? newRecord.supervisor && (await tx.getRepository(Employee).findOneBy({ id: newRecord.supervisor.id }))\n : undefined\n\n const department =\n 'department' in newRecord\n ? newRecord.department && (await tx.getRepository(Department).findOneBy({ id: newRecord.department.id }))\n : undefined\n\n const connectedUser =\n 'user' in newRecord\n ? newRecord.user && (await tx.getRepository(User).findOneBy({ id: newRecord.user.id }))\n : undefined\n\n const result = await employeeRepo.save({\n ...newRecord,\n supervisor,\n department,\n user: connectedUser,\n domain,\n creator: user,\n updater: user\n })\n\n if (newRecord.photo) {\n await createAttachment(\n null,\n {\n attachment: {\n file: newRecord.photo,\n refType: Employee.name,\n refBy: result.id\n }\n },\n context\n )\n }\n\n results.push({ ...result, cuFlag: '+' })\n }\n }\n\n if (_updateRecords.length > 0) {\n for (let i = 0; i < _updateRecords.length; i++) {\n const updateRecord = _updateRecords[i]\n\n const supervisor =\n 'supervisor' in updateRecord\n ? updateRecord.supervisor &&\n (await tx.getRepository(Employee).findOneBy({ id: updateRecord.supervisor.id }))\n : undefined\n\n const department =\n 'department' in updateRecord\n ? updateRecord.department &&\n (await tx.getRepository(Department).findOneBy({ id: updateRecord.department.id }))\n : undefined\n\n const connectedUser =\n 'user' in updateRecord\n ? updateRecord.user && (await tx.getRepository(User).findOneBy({ id: updateRecord.user.id }))\n : undefined\n\n const employee = await employeeRepo.findOneBy({ id: updateRecord.id })\n\n const result = await employeeRepo.save({\n ...employee,\n ...updateRecord,\n supervisor,\n department,\n user: connectedUser,\n updater: user\n })\n\n if (updateRecord.photo) {\n await deleteAttachmentsByRef(null, { refBys: [result.id] }, context)\n await createAttachment(\n null,\n {\n attachment: {\n file: updateRecord.photo,\n refType: Employee.name,\n refBy: result.id\n }\n },\n context\n )\n }\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete Employee' })\n async deleteEmployee(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(Employee).delete({ domain: { id: domain.id }, id })\n await deleteAttachmentsByRef(null, { refBys: [id] }, context)\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple Employees' })\n async deleteEmployees(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(Employee).delete({\n domain: { id: domain.id },\n id: In(ids)\n })\n\n await deleteAttachmentsByRef(null, { refBys: ids }, context)\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To import multiple Employees' })\n async importEmployees(\n @Arg('employees', type => [EmployeePatch]) employees: EmployeePatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n employees.map(async (employee: EmployeePatch) => {\n const createdEmployee: Employee = await tx.getRepository(Employee).save({ domain, ...employee })\n })\n )\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Employee, { description: 'To attach a contact on Employee' })\n async attachContact(\n @Arg('id') id: string,\n @Arg('contactId') contactId: string,\n @Ctx() context: ResolverContext\n ): Promise<Employee> {\n const { domain, user, tx } = context.state\n\n const employeeRepository = tx.getRepository(Employee)\n const employee = await employeeRepository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const contactRepository = tx.getRepository(Contact)\n const contact = await contactRepository.findOne({\n where: { domain: { id: domain.id }, id: contactId }\n })\n\n if (!contact) {\n throw Error(`Contact not found with given contactId(${contactId}).`)\n }\n\n const result = await employeeRepository.save({\n ...employee,\n name: contact.name,\n contact: { id: contactId },\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => Employee, { description: 'To detach a contact from Employee' })\n async detachContact(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Employee> {\n const { domain, user, tx } = context.state\n\n const repository = tx.getRepository(Employee)\n const employee = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const result = await repository.save({\n ...employee,\n contact: null,\n updater: user\n })\n\n return result\n }\n\n // @Directive('@privilege')\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To register employee as a system user' })\n async registerEmployeeAsSystemUser(\n @Arg('id', { description: 'Employee Id' }) id: string,\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, user, tx } = context.state\n\n const employeeRepository = tx.getRepository(Employee)\n const employee = await employeeRepository.findOne({\n where: { domain: { id: domain.id }, id },\n relations: ['contact', 'user']\n })\n\n return true\n\n /* \n process\n\n 0. 이미 연결된 사용자가 없어야 한다.\n 1. contact 정보가 있어야 한다.\n 2. contact 정보에 대표 email 정보가 있어야 한다.\n 3. employee 의 직책 정보가 있어야 한다. => role 과 연결된다.\n 4. 사용자 중에서 동일한 이메일을 가진 사용자가 있는가 확인한다.\n 5. 그 사용자가 이 도메인에 연결되어 있는 지 확인한다. 없다면 실패.\n 6. 직책에 해당하는 역할이 있는 지 확인한다.\n 7. 시스템에 사용자를 등록한다.\n 8. 역할을 추가한다.\n */\n // const result = await employeeRepository.save({\n // ...employee,\n // name: contact.name,\n // contact: { id: contactId },\n // updater: user\n // })\n\n // return result\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"employee-mutation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Q,CAAC;GACN,gBAAgB,CA8W5B","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { getRepository } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { createAttachment, deleteAttachmentsByRef } from '@things-factory/attachment-base'\nimport { Contact } from '@things-factory/contact'\n\nimport { Employee } from './employee'\nimport { NewEmployee, EmployeePatch } from './employee-type'\nimport { Department } from '../department/department'\n\nimport {\n onDeleteEmployeeAsSystemUser,\n onUpdateEmployeeAsSystemUser,\n registerEmployeeAsSystemUser\n} from '../../controllers/register-employee-as-system-user'\n\n@Resolver(Employee)\nexport class EmployeeMutation {\n @Directive('@transaction')\n @Directive('@privilege(category: \"employee\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Employee, {\n description:\n 'Creates a new employee record with the provided details. Optionally associates the employee with a supervisor, department, and system user. If a photo is provided, it will be attached to the employee record.'\n })\n async createEmployee(@Arg('employee') employee: NewEmployee, @Ctx() context: ResolverContext): Promise<Employee> {\n const { domain, user, tx } = context.state\n\n const supervisor =\n 'supervisor' in employee\n ? employee.supervisor && (await getRepository(Employee, tx).findOneBy({ id: employee.supervisor.id }))\n : undefined\n\n const department =\n 'department' in employee\n ? employee.department && (await getRepository(Department, tx).findOneBy({ id: employee.department.id }))\n : undefined\n\n const connectedUser =\n 'user' in employee\n ? employee.user && (await getRepository(User, tx).findOneBy({ id: employee.user.id }))\n : undefined\n\n const result = await getRepository(Employee, tx).save({\n ...employee,\n supervisor,\n department,\n user: connectedUser,\n domain,\n creator: user,\n updater: user\n })\n\n if (employee.photo) {\n await createAttachment(\n null,\n {\n attachment: {\n file: employee.photo,\n refType: Employee.name,\n refBy: result.id\n }\n },\n context\n )\n }\n\n return result\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"employee\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Employee, {\n description:\n 'Updates the details of an existing employee identified by the given ID. Optionally updates the supervisor, department, system user, and photo associated with the employee.'\n })\n async updateEmployee(\n @Arg('id') id: string,\n @Arg('patch') patch: EmployeePatch,\n @Ctx() context: ResolverContext\n ): Promise<Employee> {\n const { domain, user, tx } = context.state\n\n const supervisor =\n 'supervisor' in patch\n ? patch.supervisor && (await getRepository(Employee, tx).findOneBy({ id: patch.supervisor.id }))\n : undefined\n\n const department =\n 'department' in patch\n ? patch.department && (await getRepository(Department, tx).findOneBy({ id: patch.department.id }))\n : undefined\n\n const connectedUser =\n 'user' in patch ? patch.user && (await getRepository(User, tx).findOneBy({ id: patch.user.id })) : undefined\n\n const repository = getRepository(Employee, tx)\n const employee = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n onUpdateEmployeeAsSystemUser(patch, context)\n\n const result = await repository.save({\n ...employee,\n ...patch,\n supervisor,\n department,\n user: connectedUser,\n updater: user\n })\n\n if (patch.photo) {\n await deleteAttachmentsByRef(null, { refBys: [result.id] }, context)\n await createAttachment(\n null,\n {\n attachment: {\n file: patch.photo,\n refType: Employee.name,\n refBy: result.id\n }\n },\n context\n )\n }\n\n return result\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"employee\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => [Employee], {\n description:\n 'Updates or creates multiple employee records based on the provided patches. New employees are created if the \"cuFlag\" is \"+\", and existing employees are updated if the \"cuFlag\" is \"M\".'\n })\n async updateMultipleEmployee(\n @Arg('patches', type => [EmployeePatch]) patches: EmployeePatch[],\n @Ctx() context: ResolverContext\n ): Promise<Employee[]> {\n const { domain, user, tx } = context.state\n\n let results = []\n const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')\n const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')\n const employeeRepo = getRepository(Employee, tx)\n\n if (_createRecords.length > 0) {\n for (let i = 0; i < _createRecords.length; i++) {\n const newRecord = _createRecords[i]\n\n const supervisor =\n 'supervisor' in newRecord\n ? newRecord.supervisor && (await getRepository(Employee, tx).findOneBy({ id: newRecord.supervisor.id }))\n : undefined\n\n const department =\n 'department' in newRecord\n ? newRecord.department && (await getRepository(Department, tx).findOneBy({ id: newRecord.department.id }))\n : undefined\n\n const connectedUser =\n 'user' in newRecord\n ? newRecord.user && (await getRepository(User, tx).findOneBy({ id: newRecord.user.id }))\n : undefined\n\n const result = await employeeRepo.save({\n ...newRecord,\n supervisor,\n department,\n user: connectedUser,\n domain,\n creator: user,\n updater: user\n })\n\n if (newRecord.photo) {\n await createAttachment(\n null,\n {\n attachment: {\n file: newRecord.photo,\n refType: Employee.name,\n refBy: result.id\n }\n },\n context\n )\n }\n\n results.push({ ...result, cuFlag: '+' })\n }\n }\n\n if (_updateRecords.length > 0) {\n for (let i = 0; i < _updateRecords.length; i++) {\n const updateRecord = _updateRecords[i]\n\n const supervisor =\n 'supervisor' in updateRecord\n ? updateRecord.supervisor &&\n (await getRepository(Employee, tx).findOneBy({ id: updateRecord.supervisor.id }))\n : undefined\n\n const department =\n 'department' in updateRecord\n ? updateRecord.department &&\n (await getRepository(Department, tx).findOneBy({ id: updateRecord.department.id }))\n : undefined\n\n const connectedUser =\n 'user' in updateRecord\n ? updateRecord.user && (await getRepository(User, tx).findOneBy({ id: updateRecord.user.id }))\n : undefined\n\n const employee = await employeeRepo.findOneBy({ id: updateRecord.id })\n\n onUpdateEmployeeAsSystemUser(updateRecord, context)\n\n const result = await employeeRepo.save({\n ...employee,\n ...updateRecord,\n supervisor,\n department,\n user: connectedUser,\n updater: user\n })\n\n if (updateRecord.photo) {\n await deleteAttachmentsByRef(null, { refBys: [result.id] }, context)\n await createAttachment(\n null,\n {\n attachment: {\n file: updateRecord.photo,\n refType: Employee.name,\n refBy: result.id\n }\n },\n context\n )\n }\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"employee\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, {\n description:\n 'Deletes an employee record identified by the given ID. Also deletes any attachments associated with the employee.'\n })\n async deleteEmployee(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n onDeleteEmployeeAsSystemUser(id, context)\n await getRepository(Employee, tx).delete({ domain: { id: domain.id }, id })\n await deleteAttachmentsByRef(null, { refBys: [id] }, context)\n\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"employee\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, {\n description:\n 'Deletes multiple employee records identified by the given IDs. Also deletes any attachments associated with each employee.'\n })\n async deleteEmployees(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n for (let id of ids) {\n onDeleteEmployeeAsSystemUser(id, context)\n }\n\n await getRepository(Employee, tx).delete({\n domain: { id: domain.id },\n id: In(ids)\n })\n\n await deleteAttachmentsByRef(null, { refBys: ids }, context)\n\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"employee\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, {\n description:\n 'Imports multiple employee records into the system. Each employee record must be provided in the EmployeePatch format.'\n })\n async importEmployees(\n @Arg('employees', type => [EmployeePatch]) employees: EmployeePatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n employees.map(async (employee: EmployeePatch) => {\n const createdEmployee: Employee = await getRepository(Employee, tx).save({ domain, ...employee })\n })\n )\n\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"employee\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Employee, {\n description:\n 'Attaches an existing contact to an employee. The contact is identified by its ID and the employee is identified by their ID.'\n })\n async attachContact(\n @Arg('id') id: string,\n @Arg('contactId') contactId: string,\n @Ctx() context: ResolverContext\n ): Promise<Employee> {\n const { domain, user, tx } = context.state\n\n const employeeRepository = getRepository(Employee, tx)\n const employee = await employeeRepository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const contactRepository = getRepository(Contact, tx)\n const contact = await contactRepository.findOne({\n where: { domain: { id: domain.id }, id: contactId }\n })\n\n if (!contact) {\n throw Error(`Contact not found with given contactId(${contactId}).`)\n }\n\n const result = await employeeRepository.save({\n ...employee,\n name: contact.name,\n contact: { id: contactId },\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"employee\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Employee, {\n description: 'Detaches an existing contact from an employee. The employee is identified by their ID.'\n })\n async detachContact(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Employee> {\n const { domain, user, tx } = context.state\n\n const repository = getRepository(Employee, tx)\n const employee = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const result = await repository.save({\n ...employee,\n contact: null,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"user\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, {\n description:\n 'Registers an existing employee as a system user, granting them access to the system. The employee is identified by their ID.'\n })\n async registerEmployeeAsSystemUser(\n @Arg('employeeId', { description: 'Employee Id' }) employeeId: string,\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n return !!registerEmployeeAsSystemUser(employeeId, context)\n }\n}\n"]}
|
|
@@ -9,8 +9,8 @@ export declare class EmployeeQuery {
|
|
|
9
9
|
employees(params: ListParam, context: ResolverContext): Promise<EmployeeList>;
|
|
10
10
|
photo(employee: Employee): Promise<string | undefined>;
|
|
11
11
|
phone(employee: Employee, context: ResolverContext): Promise<string>;
|
|
12
|
-
address(employee: Employee, context: ResolverContext): Promise<string>;
|
|
13
|
-
email(employee: Employee, context: ResolverContext): Promise<string>;
|
|
12
|
+
address(employee: Employee, context: ResolverContext): Promise<string | undefined>;
|
|
13
|
+
email(employee: Employee, context: ResolverContext): Promise<string | undefined>;
|
|
14
14
|
profile(employee: Employee): Promise<Profile>;
|
|
15
15
|
department(employee: Employee): Promise<Department>;
|
|
16
16
|
user(employee: Employee): Promise<User>;
|