@things-factory/organization 10.1.182 → 10.1.184
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/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/service/employee/employee-history.js +2 -0
- package/dist-server/service/employee/employee-history.js.map +1 -1
- package/dist-server/service/employee/employee-mutation.d.ts +2 -0
- package/dist-server/service/employee/employee-mutation.js +26 -0
- package/dist-server/service/employee/employee-mutation.js.map +1 -1
- package/dist-server/service/employee/employee-private.d.ts +11 -0
- package/dist-server/service/employee/employee-private.js +23 -0
- package/dist-server/service/employee/employee-private.js.map +1 -0
- package/dist-server/service/employee/employee.js +2 -0
- package/dist-server/service/employee/employee.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/tests/employee-private.test.ts +37 -0
|
@@ -124,11 +124,13 @@ tslib_1.__decorate([
|
|
|
124
124
|
], EmployeeHistory.prototype, "emergencyContactPhone", void 0);
|
|
125
125
|
tslib_1.__decorate([
|
|
126
126
|
(0, typeorm_1.Column)({ nullable: true }),
|
|
127
|
+
(0, type_graphql_1.Directive)('@privilege(category: "employee-private", privilege: "query", domainOwnerGranted: true)'),
|
|
127
128
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
128
129
|
tslib_1.__metadata("design:type", String)
|
|
129
130
|
], EmployeeHistory.prototype, "bankAccount", void 0);
|
|
130
131
|
tslib_1.__decorate([
|
|
131
132
|
(0, typeorm_1.Column)({ nullable: true }),
|
|
133
|
+
(0, type_graphql_1.Directive)('@privilege(category: "employee-private", privilege: "query", domainOwnerGranted: true)'),
|
|
132
134
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
133
135
|
tslib_1.__metadata("design:type", String)
|
|
134
136
|
], EmployeeHistory.prototype, "bankName", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"employee-history.js","sourceRoot":"","sources":["../../../server/service/employee/employee-history.ts"],"names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;IAZ3B,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EACJ,uBAAuB,EACvB,CAAC,eAAgC,EAAE,EAAE,CAAC,CAAC,eAAe,CAAC,UAAU,EAAE,eAAe,CAAC,OAAO,CAAC,EAC3F,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB;IACA,IAAA,eAAK,EACJ,uBAAuB,EACvB,CAAC,eAAgC,EAAE,EAAE,CAAC,CAAC,eAAe,CAAC,MAAM,EAAE,eAAe,CAAC,UAAU,EAAE,eAAe,CAAC,OAAO,CAAC,EACnH,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB;IACA,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,4BAA4B,EAAE,CAAC;GAC7C,eAAe,CA0J3B","sourcesContent":["import { Field, ID, ObjectType } from 'type-graphql'\nimport { Column, Entity, Index, ManyToOne, OneToMany, PrimaryGeneratedColumn, RelationId } from 'typeorm'\n\nimport {\n HistoryActionColumn,\n HistoryActionType,\n HistoryEntityInterface,\n HistoryOriginalIdColumn\n} from '@operato/typeorm-history'\n\nimport { User } from '@things-factory/auth-base'\nimport { Contact } from '@things-factory/contact'\n\nimport { config } from '@things-factory/env'\nimport { Domain } from '@things-factory/shell'\n\nimport { Employee, EmployeeType } from './employee'\nimport { Department } from '../department/department'\n\nconst ORMCONFIG = config.get('ormconfig', {})\nconst DATABASE_TYPE = ORMCONFIG.type\n\n@Entity()\n@Index(\n 'ix_employee_history_0',\n (employeeHistory: EmployeeHistory) => [employeeHistory.originalId, employeeHistory.version],\n { unique: true }\n)\n@Index(\n 'ix_employee_history_1',\n (employeeHistory: EmployeeHistory) => [employeeHistory.domain, employeeHistory.originalId, employeeHistory.version],\n { unique: true }\n)\n@ObjectType({ description: 'History Entity of Employee' })\nexport class EmployeeHistory implements HistoryEntityInterface<Employee> {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @Column({ nullable: true, default: 1 })\n @Field({ nullable: true })\n version?: number = 1\n\n @ManyToOne(type => Domain)\n @Field(type => Domain)\n domain?: Domain\n\n @RelationId((employee: Employee) => employee.domain)\n domainId?: string\n\n @Column()\n @Field()\n controlNo: string\n\n @Column()\n @Field({ nullable: true })\n name?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n alias?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n jobResponsibility?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n jobPosition?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n note?: string\n\n @ManyToOne(type => Employee, supervisor => supervisor.supervises, { nullable: true })\n @Field({ nullable: true })\n supervisor?: Employee\n\n @RelationId((employee: Employee) => employee.supervisor)\n supervisorId?: string\n\n @OneToMany(type => Employee, employee => employee.supervisor)\n @Field(type => [Employee])\n supervises?: Employee[]\n\n @OneToMany(type => Department, department => department.manager)\n @Field(type => [Department])\n manages?: Department[]\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n active?: boolean\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n type?: EmployeeType\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'The hire day in YYYY-MM-DD format' })\n hiredOn?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'The retire day in YYYY-MM-DD format' })\n retiredOn?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n extension?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n emergencyContact?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n emergencyContactPhone?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n bankAccount?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n bankName?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n createdAt?: Date\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n updatedAt?: Date\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n deletedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n creator?: User\n\n @RelationId((employee: Employee) => employee.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((employee: Employee) => employee.updater)\n updaterId?: string\n\n @Field(type => String, { nullable: true })\n photo?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field({ nullable: true })\n user?: User\n\n @RelationId((employee: Employee) => employee.user)\n userId?: string\n\n @ManyToOne(type => Contact, { nullable: true })\n @Field({ nullable: true })\n contact?: Contact\n\n @RelationId((employee: Employee) => employee.contact)\n contactId?: string\n\n @HistoryOriginalIdColumn()\n public originalId!: string\n\n @HistoryActionColumn({\n nullable: false,\n type:\n DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'\n ? 'enum'\n : DATABASE_TYPE == 'oracle'\n ? 'varchar2'\n : DATABASE_TYPE == 'mssql'\n ? 'nvarchar'\n : 'varchar',\n enum:\n DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'\n ? HistoryActionType\n : undefined,\n length: DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb' ? undefined : 10\n })\n public action!: HistoryActionType\n}\n"]}
|
|
1
|
+
{"version":3,"file":"employee-history.js","sourceRoot":"","sources":["../../../server/service/employee/employee-history.ts"],"names":[],"mappings":";;;;AAAA,+CAA+D;AAC/D,qCAAyG;AAEzG,8DAKiC;AAEjC,yDAAgD;AAChD,qDAAiD;AAEjD,6CAA4C;AAC5C,iDAA8C;AAE9C,yCAAmD;AACnD,yDAAqD;AAErD,MAAM,SAAS,GAAG,YAAM,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;AAC7C,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,CAAA;AAc7B,IAAM,eAAe,GAArB,MAAM,eAAe;IAArB;QAOL,YAAO,GAAY,CAAC,CAAA;IAsJtB,CAAC;CAAA,CAAA;AA7JY,0CAAe;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AAE,eAAe,CAAC,OAAO,CAAC,EACnH,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB;IACA,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,4BAA4B,EAAE,CAAC;GAC7C,eAAe,CA6J3B","sourcesContent":["import { Directive, Field, ID, ObjectType } from 'type-graphql'\nimport { Column, Entity, Index, ManyToOne, OneToMany, PrimaryGeneratedColumn, RelationId } from 'typeorm'\n\nimport {\n HistoryActionColumn,\n HistoryActionType,\n HistoryEntityInterface,\n HistoryOriginalIdColumn\n} from '@operato/typeorm-history'\n\nimport { User } from '@things-factory/auth-base'\nimport { Contact } from '@things-factory/contact'\n\nimport { config } from '@things-factory/env'\nimport { Domain } from '@things-factory/shell'\n\nimport { Employee, EmployeeType } from './employee'\nimport { Department } from '../department/department'\n\nconst ORMCONFIG = config.get('ormconfig', {})\nconst DATABASE_TYPE = ORMCONFIG.type\n\n@Entity()\n@Index(\n 'ix_employee_history_0',\n (employeeHistory: EmployeeHistory) => [employeeHistory.originalId, employeeHistory.version],\n { unique: true }\n)\n@Index(\n 'ix_employee_history_1',\n (employeeHistory: EmployeeHistory) => [employeeHistory.domain, employeeHistory.originalId, employeeHistory.version],\n { unique: true }\n)\n@ObjectType({ description: 'History Entity of Employee' })\nexport class EmployeeHistory implements HistoryEntityInterface<Employee> {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @Column({ nullable: true, default: 1 })\n @Field({ nullable: true })\n version?: number = 1\n\n @ManyToOne(type => Domain)\n @Field(type => Domain)\n domain?: Domain\n\n @RelationId((employee: Employee) => employee.domain)\n domainId?: string\n\n @Column()\n @Field()\n controlNo: string\n\n @Column()\n @Field({ nullable: true })\n name?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n alias?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n jobResponsibility?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n jobPosition?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n note?: string\n\n @ManyToOne(type => Employee, supervisor => supervisor.supervises, { nullable: true })\n @Field({ nullable: true })\n supervisor?: Employee\n\n @RelationId((employee: Employee) => employee.supervisor)\n supervisorId?: string\n\n @OneToMany(type => Employee, employee => employee.supervisor)\n @Field(type => [Employee])\n supervises?: Employee[]\n\n @OneToMany(type => Department, department => department.manager)\n @Field(type => [Department])\n manages?: Department[]\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n active?: boolean\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n type?: EmployeeType\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'The hire day in YYYY-MM-DD format' })\n hiredOn?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'The retire day in YYYY-MM-DD format' })\n retiredOn?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n extension?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n emergencyContact?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n emergencyContactPhone?: string\n\n /* The pay account is HR-payroll's (ADR-0139), not the roster's. */\n @Column({ nullable: true })\n @Directive('@privilege(category: \"employee-private\", privilege: \"query\", domainOwnerGranted: true)')\n @Field({ nullable: true })\n bankAccount?: string\n\n @Column({ nullable: true })\n @Directive('@privilege(category: \"employee-private\", privilege: \"query\", domainOwnerGranted: true)')\n @Field({ nullable: true })\n bankName?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n createdAt?: Date\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n updatedAt?: Date\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n deletedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n creator?: User\n\n @RelationId((employee: Employee) => employee.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((employee: Employee) => employee.updater)\n updaterId?: string\n\n @Field(type => String, { nullable: true })\n photo?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field({ nullable: true })\n user?: User\n\n @RelationId((employee: Employee) => employee.user)\n userId?: string\n\n @ManyToOne(type => Contact, { nullable: true })\n @Field({ nullable: true })\n contact?: Contact\n\n @RelationId((employee: Employee) => employee.contact)\n contactId?: string\n\n @HistoryOriginalIdColumn()\n public originalId!: string\n\n @HistoryActionColumn({\n nullable: false,\n type:\n DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'\n ? 'enum'\n : DATABASE_TYPE == 'oracle'\n ? 'varchar2'\n : DATABASE_TYPE == 'mssql'\n ? 'nvarchar'\n : 'varchar',\n enum:\n DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'\n ? HistoryActionType\n : undefined,\n length: DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb' ? undefined : 10\n })\n public action!: HistoryActionType\n}\n"]}
|
|
@@ -2,6 +2,8 @@ import { Employee } from './employee';
|
|
|
2
2
|
import { NewEmployee, EmployeePatch } from './employee-type';
|
|
3
3
|
export declare class EmployeeMutation {
|
|
4
4
|
createEmployee(employee: NewEmployee, context: ResolverContext): Promise<Employee>;
|
|
5
|
+
/** An employee's pay account - HR-payroll's, so its own door and privilege (ADR-0139). Empty text clears a field. */
|
|
6
|
+
updateEmployeePayAccount(id: string, bankName: string, bankAccount: string, context: ResolverContext): Promise<Employee>;
|
|
5
7
|
updateEmployee(id: string, patch: EmployeePatch, context: ResolverContext): Promise<Employee>;
|
|
6
8
|
updateMultipleEmployee(patches: EmployeePatch[], context: ResolverContext): Promise<Employee[]>;
|
|
7
9
|
deleteEmployee(id: string, context: ResolverContext): Promise<boolean>;
|
|
@@ -11,11 +11,13 @@ const employee_1 = require("./employee");
|
|
|
11
11
|
const employee_type_1 = require("./employee-type");
|
|
12
12
|
const department_1 = require("../department/department");
|
|
13
13
|
const employee_day_1 = require("./employee-day");
|
|
14
|
+
const employee_private_1 = require("./employee-private");
|
|
14
15
|
const domain_reference_1 = require("../domain-reference");
|
|
15
16
|
const register_employee_as_system_user_1 = require("../../controllers/register-employee-as-system-user");
|
|
16
17
|
let EmployeeMutation = class EmployeeMutation {
|
|
17
18
|
async createEmployee(employee, context) {
|
|
18
19
|
const { domain, user, tx } = context.state;
|
|
20
|
+
(0, employee_private_1.refusePrivateWrite)([employee]);
|
|
19
21
|
const supervisor = await (0, domain_reference_1.referenceInDomain)((0, shell_1.getRepository)(employee_1.Employee, tx), 'supervisor' in employee ? employee.supervisor : undefined, domain, 'supervisor');
|
|
20
22
|
const department = await (0, domain_reference_1.referenceInDomain)((0, shell_1.getRepository)(department_1.Department, tx), 'department' in employee ? employee.department : undefined, domain, 'department');
|
|
21
23
|
const connectedUser = await (0, domain_reference_1.userInDomain)('user' in employee ? employee.user : undefined, domain, tx);
|
|
@@ -39,8 +41,18 @@ let EmployeeMutation = class EmployeeMutation {
|
|
|
39
41
|
}
|
|
40
42
|
return result;
|
|
41
43
|
}
|
|
44
|
+
/** An employee's pay account - HR-payroll's, so its own door and privilege (ADR-0139). Empty text clears a field. */
|
|
45
|
+
async updateEmployeePayAccount(id, bankName, bankAccount, context) {
|
|
46
|
+
const { domain, user, tx } = context.state;
|
|
47
|
+
const repository = (0, shell_1.getRepository)(employee_1.Employee, tx);
|
|
48
|
+
const employee = await repository.findOne({ where: { domain: { id: domain.id }, id } });
|
|
49
|
+
if (!employee)
|
|
50
|
+
throw new Error(`There is no employee ${id}.`);
|
|
51
|
+
return await repository.save({ ...employee, bankName: bankName || null, bankAccount: bankAccount || null, updater: user });
|
|
52
|
+
}
|
|
42
53
|
async updateEmployee(id, patch, context) {
|
|
43
54
|
const { domain, user, tx } = context.state;
|
|
55
|
+
(0, employee_private_1.refusePrivateWrite)([patch]);
|
|
44
56
|
const supervisor = await (0, domain_reference_1.referenceInDomain)((0, shell_1.getRepository)(employee_1.Employee, tx), 'supervisor' in patch ? patch.supervisor : undefined, domain, 'supervisor');
|
|
45
57
|
const department = await (0, domain_reference_1.referenceInDomain)((0, shell_1.getRepository)(department_1.Department, tx), 'department' in patch ? patch.department : undefined, domain, 'department');
|
|
46
58
|
const connectedUser = await (0, domain_reference_1.userInDomain)('user' in patch ? patch.user : undefined, domain, tx);
|
|
@@ -71,6 +83,7 @@ let EmployeeMutation = class EmployeeMutation {
|
|
|
71
83
|
}
|
|
72
84
|
async updateMultipleEmployee(patches, context) {
|
|
73
85
|
const { domain, user, tx } = context.state;
|
|
86
|
+
(0, employee_private_1.refusePrivateWrite)(patches);
|
|
74
87
|
let results = [];
|
|
75
88
|
const _createRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === '+');
|
|
76
89
|
const _updateRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === 'M');
|
|
@@ -159,6 +172,7 @@ let EmployeeMutation = class EmployeeMutation {
|
|
|
159
172
|
}
|
|
160
173
|
async importEmployees(employees, context) {
|
|
161
174
|
const { domain, tx } = context.state;
|
|
175
|
+
(0, employee_private_1.refusePrivateWrite)(employees);
|
|
162
176
|
await Promise.all(employees.map(async (employee) => {
|
|
163
177
|
const createdEmployee = await (0, shell_1.getRepository)(employee_1.Employee, tx).save({ domain, ...(0, employee_day_1.withDays)(employee) });
|
|
164
178
|
}));
|
|
@@ -215,6 +229,18 @@ tslib_1.__decorate([
|
|
|
215
229
|
tslib_1.__metadata("design:paramtypes", [employee_type_1.NewEmployee, Object]),
|
|
216
230
|
tslib_1.__metadata("design:returntype", Promise)
|
|
217
231
|
], EmployeeMutation.prototype, "createEmployee", null);
|
|
232
|
+
tslib_1.__decorate([
|
|
233
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
|
234
|
+
(0, type_graphql_1.Directive)('@privilege(category: "employee-private", privilege: "mutation", domainOwnerGranted: true)'),
|
|
235
|
+
(0, type_graphql_1.Mutation)(returns => employee_1.Employee, { description: "Sets an employee's pay account - the bank and the account number their pay goes to" }),
|
|
236
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
237
|
+
tslib_1.__param(1, (0, type_graphql_1.Arg)('bankName', { nullable: true })),
|
|
238
|
+
tslib_1.__param(2, (0, type_graphql_1.Arg)('bankAccount', { nullable: true })),
|
|
239
|
+
tslib_1.__param(3, (0, type_graphql_1.Ctx)()),
|
|
240
|
+
tslib_1.__metadata("design:type", Function),
|
|
241
|
+
tslib_1.__metadata("design:paramtypes", [String, String, String, Object]),
|
|
242
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
243
|
+
], EmployeeMutation.prototype, "updateEmployeePayAccount", null);
|
|
218
244
|
tslib_1.__decorate([
|
|
219
245
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
220
246
|
(0, type_graphql_1.Directive)('@privilege(category: "employee", privilege: "mutation", domainOwnerGranted: true)'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"employee-mutation.js","sourceRoot":"","sources":["../../../server/service/employee/employee-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,iDAAqD;AAErD,qEAA0F;AAC1F,qDAAiD;AAEjD,yCAAqC;AACrC,mDAA4D;AAC5D,yDAAqD;AACrD,iDAAyC;AACzC,0DAAqE;AAErE,yGAI2D;AAGpD,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAOrB,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,GAAG,MAAM,IAAA,oCAAiB,EACxC,IAAA,qBAAa,EAAC,mBAAQ,EAAE,EAAE,CAAC,EAC3B,YAAY,IAAI,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,EAC1D,MAAM,EACN,YAAY,CACb,CAAA;QAED,MAAM,UAAU,GAAG,MAAM,IAAA,oCAAiB,EAC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C,CAAA;IAAc,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;qDAehD;AAQK;IANL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,wBAAS,EAAC,+EAA+E,CAAC;IAC1F,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE;QAC5B,WAAW,EACT,8HAA8H;KACjI,CAAC;IAEC,mBAAA,IAAA,kBAAG,EAAC,YAAY,EAAE,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC,CAAA;IACjD,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;oEAGP;2BAvXU,gBAAgB;IAD5B,IAAA,uBAAQ,EAAC,mBAAQ,CAAC;GACN,gBAAgB,CAwX5B","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'\nimport { withDays } from './employee-day'\nimport { referenceInDomain, userInDomain } from '../domain-reference'\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 = await referenceInDomain(\n getRepository(Employee, tx),\n 'supervisor' in employee ? employee.supervisor : undefined,\n domain,\n 'supervisor'\n )\n\n const department = await referenceInDomain(\n getRepository(Department, tx),\n 'department' in employee ? employee.department : undefined,\n domain,\n 'department'\n )\n\n const connectedUser = await userInDomain('user' in employee ? employee.user : undefined, domain, tx)\n\n const result = await getRepository(Employee, tx).save({\n ...withDays(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 = await referenceInDomain(\n getRepository(Employee, tx),\n 'supervisor' in patch ? patch.supervisor : undefined,\n domain,\n 'supervisor'\n )\n\n const department = await referenceInDomain(\n getRepository(Department, tx),\n 'department' in patch ? patch.department : undefined,\n domain,\n 'department'\n )\n\n const connectedUser = await userInDomain('user' in patch ? patch.user : undefined, domain, tx)\n\n const repository = getRepository(Employee, tx)\n const employee = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n await onUpdateEmployeeAsSystemUser(patch, context)\n\n const result = await repository.save({\n ...employee,\n ...withDays(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 = await referenceInDomain(\n getRepository(Employee, tx),\n 'supervisor' in newRecord ? newRecord.supervisor : undefined,\n domain,\n 'supervisor'\n )\n\n const department = await referenceInDomain(\n getRepository(Department, tx),\n 'department' in newRecord ? newRecord.department : undefined,\n domain,\n 'department'\n )\n\n const connectedUser = await userInDomain('user' in newRecord ? newRecord.user : undefined, domain, tx)\n\n const result = await employeeRepo.save({\n ...withDays(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 = await referenceInDomain(\n getRepository(Employee, tx),\n 'supervisor' in updateRecord ? updateRecord.supervisor : undefined,\n domain,\n 'supervisor'\n )\n\n const department = await referenceInDomain(\n getRepository(Department, tx),\n 'department' in updateRecord ? updateRecord.department : undefined,\n domain,\n 'department'\n )\n\n const connectedUser = await userInDomain('user' in updateRecord ? updateRecord.user : undefined, domain, tx)\n\n const employee = await employeeRepo.findOne({\n where: { domain: { id: domain.id }, id: updateRecord.id }\n })\n\n if (!employee) {\n throw new Error(`failed to find employee to update: ${updateRecord.id}`)\n }\n\n await onUpdateEmployeeAsSystemUser(updateRecord, context)\n\n const result = await employeeRepo.save({\n ...employee,\n ...withDays(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 await 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 await 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, ...withDays(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 !!(await registerEmployeeAsSystemUser(employeeId, context))\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"employee-mutation.js","sourceRoot":"","sources":["../../../server/service/employee/employee-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,iDAAqD;AAErD,qEAA0F;AAC1F,qDAAiD;AAEjD,yCAAqC;AACrC,mDAA4D;AAC5D,yDAAqD;AACrD,iDAAyC;AACzC,yDAAuD;AACvD,0DAAqE;AAErE,yGAI2D;AAGpD,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAOrB,AAAN,KAAK,CAAC,cAAc,CAAkB,QAAqB,EAAS,OAAwB;QAC1F,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAC1C,IAAA,qCAAkB,EAAC,CAAC,QAAe,CAAC,CAAC,CAAA;QAErC,MAAM,UAAU,GAAG,MAAM,IAAA,oCAAiB,EACxC,IAAA,qBAAa,EAAC,mBAAQ,EAAE,EAAE,CAAC,EAC3B,YAAY,IAAI,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,EAC1D,MAAM,EACN,YAAY,CACb,CAAA;QAED,MAAM,UAAU,GAAG,MAAM,IAAA,oCAAiB,EACxC,IAAA,qBAAa,EAAC,uBAAU,EAAE,EAAE,CAAC,EAC7B,YAAY,IAAI,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,EAC1D,MAAM,EACN,YAAY,CACb,CAAA;QAED,MAAM,aAAa,GAAG,MAAM,IAAA,+BAAY,EAAC,MAAM,IAAI,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,CA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AC;IAEC,mBAAA,IAAA,kBAAG,EAAC,YAAY,EAAE,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC,CAAA;IACjD,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;oEAGP;2BA5YU,gBAAgB;IAD5B,IAAA,uBAAQ,EAAC,mBAAQ,CAAC;GACN,gBAAgB,CA6Y5B","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'\nimport { withDays } from './employee-day'\nimport { refusePrivateWrite } from './employee-private'\nimport { referenceInDomain, userInDomain } from '../domain-reference'\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 refusePrivateWrite([employee as any])\n\n const supervisor = await referenceInDomain(\n getRepository(Employee, tx),\n 'supervisor' in employee ? employee.supervisor : undefined,\n domain,\n 'supervisor'\n )\n\n const department = await referenceInDomain(\n getRepository(Department, tx),\n 'department' in employee ? employee.department : undefined,\n domain,\n 'department'\n )\n\n const connectedUser = await userInDomain('user' in employee ? employee.user : undefined, domain, tx)\n\n const result = await getRepository(Employee, tx).save({\n ...withDays(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 /** An employee's pay account - HR-payroll's, so its own door and privilege (ADR-0139). Empty text clears a field. */\n @Directive('@transaction')\n @Directive('@privilege(category: \"employee-private\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Employee, { description: \"Sets an employee's pay account - the bank and the account number their pay goes to\" })\n async updateEmployeePayAccount(\n @Arg('id') id: string,\n @Arg('bankName', { nullable: true }) bankName: string,\n @Arg('bankAccount', { nullable: true }) bankAccount: string,\n @Ctx() context: ResolverContext\n ): Promise<Employee> {\n const { domain, user, tx } = context.state\n const repository = getRepository(Employee, tx)\n const employee = await repository.findOne({ where: { domain: { id: domain.id }, id } })\n if (!employee) throw new Error(`There is no employee ${id}.`)\n return await repository.save({ ...employee, bankName: bankName || null, bankAccount: bankAccount || null, updater: user } as any)\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 refusePrivateWrite([patch as any])\n\n const supervisor = await referenceInDomain(\n getRepository(Employee, tx),\n 'supervisor' in patch ? patch.supervisor : undefined,\n domain,\n 'supervisor'\n )\n\n const department = await referenceInDomain(\n getRepository(Department, tx),\n 'department' in patch ? patch.department : undefined,\n domain,\n 'department'\n )\n\n const connectedUser = await userInDomain('user' in patch ? patch.user : undefined, domain, tx)\n\n const repository = getRepository(Employee, tx)\n const employee = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n await onUpdateEmployeeAsSystemUser(patch, context)\n\n const result = await repository.save({\n ...employee,\n ...withDays(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 refusePrivateWrite(patches as any[])\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 = await referenceInDomain(\n getRepository(Employee, tx),\n 'supervisor' in newRecord ? newRecord.supervisor : undefined,\n domain,\n 'supervisor'\n )\n\n const department = await referenceInDomain(\n getRepository(Department, tx),\n 'department' in newRecord ? newRecord.department : undefined,\n domain,\n 'department'\n )\n\n const connectedUser = await userInDomain('user' in newRecord ? newRecord.user : undefined, domain, tx)\n\n const result = await employeeRepo.save({\n ...withDays(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 = await referenceInDomain(\n getRepository(Employee, tx),\n 'supervisor' in updateRecord ? updateRecord.supervisor : undefined,\n domain,\n 'supervisor'\n )\n\n const department = await referenceInDomain(\n getRepository(Department, tx),\n 'department' in updateRecord ? updateRecord.department : undefined,\n domain,\n 'department'\n )\n\n const connectedUser = await userInDomain('user' in updateRecord ? updateRecord.user : undefined, domain, tx)\n\n const employee = await employeeRepo.findOne({\n where: { domain: { id: domain.id }, id: updateRecord.id }\n })\n\n if (!employee) {\n throw new Error(`failed to find employee to update: ${updateRecord.id}`)\n }\n\n await onUpdateEmployeeAsSystemUser(updateRecord, context)\n\n const result = await employeeRepo.save({\n ...employee,\n ...withDays(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 await 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 await 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 refusePrivateWrite(employees as any[])\n\n await Promise.all(\n employees.map(async (employee: EmployeePatch) => {\n const createdEmployee: Employee = await getRepository(Employee, tx).save({ domain, ...withDays(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 !!(await registerEmployeeAsSystemUser(employeeId, context))\n }\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An employee's pay account - where their pay goes. Who was paid what is HR-payroll's fact (ADR-0139), so these fields
|
|
3
|
+
* are read under `employee-private`, apart from the roster every seat reads (`employee`), and written through one door,
|
|
4
|
+
* `updateEmployeePayAccount`, which asks `employee-private:mutation`. The roster's own writes do not take them: a door
|
|
5
|
+
* is what declares a privilege, so the write has one.
|
|
6
|
+
*/
|
|
7
|
+
export declare const EMPLOYEE_PRIVATE_FIELDS: readonly ["bankAccount", "bankName"];
|
|
8
|
+
/** The private fields a patch writes - a field left out of the patch is not written. */
|
|
9
|
+
export declare function privateFieldsOf(patch: Record<string, unknown> | null | undefined): string[];
|
|
10
|
+
/** Refuses a roster write that carries the pay account - it is written through `updateEmployeePayAccount`. */
|
|
11
|
+
export declare function refusePrivateWrite(patches: (Record<string, unknown> | null | undefined)[]): void;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EMPLOYEE_PRIVATE_FIELDS = void 0;
|
|
4
|
+
exports.privateFieldsOf = privateFieldsOf;
|
|
5
|
+
exports.refusePrivateWrite = refusePrivateWrite;
|
|
6
|
+
/**
|
|
7
|
+
* An employee's pay account - where their pay goes. Who was paid what is HR-payroll's fact (ADR-0139), so these fields
|
|
8
|
+
* are read under `employee-private`, apart from the roster every seat reads (`employee`), and written through one door,
|
|
9
|
+
* `updateEmployeePayAccount`, which asks `employee-private:mutation`. The roster's own writes do not take them: a door
|
|
10
|
+
* is what declares a privilege, so the write has one.
|
|
11
|
+
*/
|
|
12
|
+
exports.EMPLOYEE_PRIVATE_FIELDS = ['bankAccount', 'bankName'];
|
|
13
|
+
/** The private fields a patch writes - a field left out of the patch is not written. */
|
|
14
|
+
function privateFieldsOf(patch) {
|
|
15
|
+
return exports.EMPLOYEE_PRIVATE_FIELDS.filter(field => !!patch && field in patch && patch[field] !== undefined);
|
|
16
|
+
}
|
|
17
|
+
/** Refuses a roster write that carries the pay account - it is written through `updateEmployeePayAccount`. */
|
|
18
|
+
function refusePrivateWrite(patches) {
|
|
19
|
+
const written = [...new Set(patches.flatMap(privateFieldsOf))];
|
|
20
|
+
if (written.length)
|
|
21
|
+
throw new Error(`${written.join(', ')} - an employee's pay account is written through updateEmployeePayAccount (employee-private).`);
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=employee-private.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"employee-private.js","sourceRoot":"","sources":["../../../server/service/employee/employee-private.ts"],"names":[],"mappings":";;;AASA,0CAEC;AAGD,gDAGC;AAjBD;;;;;GAKG;AACU,QAAA,uBAAuB,GAAG,CAAC,aAAa,EAAE,UAAU,CAAU,CAAA;AAE3E,wFAAwF;AACxF,SAAgB,eAAe,CAAC,KAAiD;IAC/E,OAAO,+BAAuB,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,KAAK,IAAI,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC,KAAK,SAAS,CAAC,CAAA;AACzG,CAAC;AAED,8GAA8G;AAC9G,SAAgB,kBAAkB,CAAC,OAAuD;IACxF,MAAM,OAAO,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAA;IAC9D,IAAI,OAAO,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,8FAA8F,CAAC,CAAA;AAC1J,CAAC","sourcesContent":["/**\n * An employee's pay account - where their pay goes. Who was paid what is HR-payroll's fact (ADR-0139), so these fields\n * are read under `employee-private`, apart from the roster every seat reads (`employee`), and written through one door,\n * `updateEmployeePayAccount`, which asks `employee-private:mutation`. The roster's own writes do not take them: a door\n * is what declares a privilege, so the write has one.\n */\nexport const EMPLOYEE_PRIVATE_FIELDS = ['bankAccount', 'bankName'] as const\n\n/** The private fields a patch writes - a field left out of the patch is not written. */\nexport function privateFieldsOf(patch: Record<string, unknown> | null | undefined): string[] {\n return EMPLOYEE_PRIVATE_FIELDS.filter(field => !!patch && field in patch && patch[field] !== undefined)\n}\n\n/** Refuses a roster write that carries the pay account - it is written through `updateEmployeePayAccount`. */\nexport function refusePrivateWrite(patches: (Record<string, unknown> | null | undefined)[]): void {\n const written = [...new Set(patches.flatMap(privateFieldsOf))]\n if (written.length) throw new Error(`${written.join(', ')} - an employee's pay account is written through updateEmployeePayAccount (employee-private).`)\n}\n"]}
|
|
@@ -164,11 +164,13 @@ tslib_1.__decorate([
|
|
|
164
164
|
], Employee.prototype, "emergencyContactPhone", void 0);
|
|
165
165
|
tslib_1.__decorate([
|
|
166
166
|
(0, typeorm_1.Column)({ nullable: true }),
|
|
167
|
+
(0, type_graphql_1.Directive)('@privilege(category: "employee-private", privilege: "query", domainOwnerGranted: true)'),
|
|
167
168
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
168
169
|
tslib_1.__metadata("design:type", String)
|
|
169
170
|
], Employee.prototype, "bankAccount", void 0);
|
|
170
171
|
tslib_1.__decorate([
|
|
171
172
|
(0, typeorm_1.Column)({ nullable: true }),
|
|
173
|
+
(0, type_graphql_1.Directive)('@privilege(category: "employee-private", privilege: "query", domainOwnerGranted: true)'),
|
|
172
174
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
173
175
|
tslib_1.__metadata("design:type", String)
|
|
174
176
|
], Employee.prototype, "bankName", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"employee.js","sourceRoot":"","sources":["../../../server/service/employee/employee.ts"],"names":[],"mappings":";;;;AAAA,qCAYgB;AAChB,+CAA2E;AAC3E,qDAAqD;AAErD,iDAA8C;AAC9C,yDAAgD;AAChD,qDAA0D;AAE1D,yDAAqD;AACrD,kEAA6D;AAE7D,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,qCAAqB,CAAA;IACrB,qCAAqB,CAAA;IACrB,uCAAuB,CAAA;AACzB,CAAC,EAJW,YAAY,4BAAZ,YAAY,QAIvB;AAED,IAAA,+BAAgB,EAAC,YAAY,EAAE;IAC7B,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,gCAAgC;CAC9C,CAAC,CAAA;AAOK,IAAM,QAAQ,GAAd,MAAM,QAAQ;IAAd;QAOL,YAAO,GAAY,CAAC,CAAA;IAmJtB,CAAC;CAAA,CAAA;AA1JY,4BAAQ;AAGV;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;oCACC;AAInB;IAFC,IAAA,uBAAa,GAAE;IACf,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yCACN;AAIpB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IACzB,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;sCACb,cAAM;wCAAA;AAGf;IADC,IAAA,oBAAU,EAAC,CAAC,QAAkB,EAAE,EA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AAE,CAAC;IAC3C,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCAC9B,gBAAI;yCAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,QAAkB,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC;;2CACnC;AAIlB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC3C,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCAC9B,gBAAI;yCAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,QAAkB,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC;;2CACnC;mBAzJP,QAAQ;IALpB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,eAAe,EAAE,CAAC,QAAkB,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC,EAAE;QACzG,MAAM,EAAE,IAAI;KACb,CAAC;IACD,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,qBAAqB,EAAE,CAAC;GACtC,QAAQ,CA0JpB","sourcesContent":["import {\n CreateDateColumn,\n UpdateDateColumn,\n DeleteDateColumn,\n Entity,\n Index,\n Column,\n OneToMany,\n RelationId,\n ManyToOne,\n PrimaryGeneratedColumn,\n VersionColumn\n} from 'typeorm'\nimport { ObjectType, Field, Int, ID, registerEnumType } from 'type-graphql'\nimport { GraphQLEmailAddress } from 'graphql-scalars'\n\nimport { Domain } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { Contact, Profile } from '@things-factory/contact'\n\nimport { Department } from '../department/department'\nimport { ApprovalLine } from '../approval-line/approval-line'\n\nexport enum EmployeeType {\n FULLTIME = 'FULLTIME',\n PARTTIME = 'PARTTIME',\n TEMPORARY = 'TEMPORARY'\n}\n\nregisterEnumType(EmployeeType, {\n name: 'EmployeeType',\n description: 'type enumeration of a employee'\n})\n\n@Entity()\n@Index('ix_employee_0', (employee: Employee) => [employee.domain, employee.controlNo, employee.deletedAt], {\n unique: true\n})\n@ObjectType({ description: 'Entity for Employee' })\nexport class Employee {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @VersionColumn()\n @Field({ nullable: true })\n version?: number = 1\n\n @ManyToOne(type => Domain)\n @Field(type => Domain)\n domain?: Domain\n\n @RelationId((employee: Employee) => employee.domain)\n domainId?: string\n\n @Column()\n @Field({ nullable: false })\n controlNo: string\n\n @Column()\n @Field({ nullable: true })\n name?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n alias?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n jobResponsibility?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n jobPosition?: string\n\n @ManyToOne(type => Employee, supervisor => supervisor.supervises, { nullable: true })\n @Field(type => Employee, { nullable: true })\n supervisor?: Employee\n\n @RelationId((employee: Employee) => employee.supervisor)\n supervisorId?: string\n\n @OneToMany(type => Employee, employee => employee.supervisor)\n @Field(type => [Employee])\n supervises?: Employee[]\n\n @ManyToOne(type => Department, department => department.members, { nullable: true })\n @Field(type => Department, { nullable: true })\n department?: Department\n\n @RelationId((employee: Employee) => employee.department)\n departmentId?: string\n\n @OneToMany(type => Department, department => department.manager)\n @Field(type => [Department])\n manages?: Department[]\n\n @OneToMany(type => ApprovalLine, employee => employee.ownerEmployee)\n @Field(type => [ApprovalLine])\n approvalLines?: ApprovalLine[]\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n active?: boolean\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n type?: EmployeeType\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n extension?: string\n\n @Field(type => String, { nullable: true })\n photo?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field({ nullable: true })\n user?: User\n\n @RelationId((employee: Employee) => employee.user)\n userId?: string\n\n @ManyToOne(type => Contact, { nullable: true })\n @Field({ nullable: true })\n contact?: Contact\n\n @RelationId((employee: Employee) => employee.contact)\n contactId?: string\n\n @Field(type => GraphQLEmailAddress, { nullable: true })\n email?: string\n\n @Field({ nullable: true })\n phone?: string\n\n @Field(type => Profile, { nullable: true })\n profile?: Profile\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n emergencyContact?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n emergencyContactPhone?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n bankAccount?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n bankName?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n note?: string\n\n /* Calendar days, not instants: 'YYYY-MM-DD' strings, so no time zone can move them to the day before. */\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'The hire day in YYYY-MM-DD format' })\n hiredOn?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'The retire day in YYYY-MM-DD format' })\n retiredOn?: string\n\n @CreateDateColumn()\n @Field({ nullable: true })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true })\n updatedAt?: Date\n\n @DeleteDateColumn()\n @Field({ nullable: true })\n deletedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n creator?: User\n\n @RelationId((employee: Employee) => employee.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((employee: Employee) => employee.updater)\n updaterId?: string\n}\n"]}
|
|
1
|
+
{"version":3,"file":"employee.js","sourceRoot":"","sources":["../../../server/service/employee/employee.ts"],"names":[],"mappings":";;;;AAAA,qCAYgB;AAChB,+CAAsF;AACtF,qDAAqD;AAErD,iDAA8C;AAC9C,yDAAgD;AAChD,qDAA0D;AAE1D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,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCAC9B,gBAAI;yCAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,QAAkB,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC;;2CACnC;mBA5JP,QAAQ;IALpB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,eAAe,EAAE,CAAC,QAAkB,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC,EAAE;QACzG,MAAM,EAAE,IAAI;KACb,CAAC;IACD,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,qBAAqB,EAAE,CAAC;GACtC,QAAQ,CA6JpB","sourcesContent":["import {\n CreateDateColumn,\n UpdateDateColumn,\n DeleteDateColumn,\n Entity,\n Index,\n Column,\n OneToMany,\n RelationId,\n ManyToOne,\n PrimaryGeneratedColumn,\n VersionColumn\n} from 'typeorm'\nimport { Directive, ObjectType, Field, Int, ID, registerEnumType } from 'type-graphql'\nimport { GraphQLEmailAddress } from 'graphql-scalars'\n\nimport { Domain } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { Contact, Profile } from '@things-factory/contact'\n\nimport { Department } from '../department/department'\nimport { ApprovalLine } from '../approval-line/approval-line'\n\nexport enum EmployeeType {\n FULLTIME = 'FULLTIME',\n PARTTIME = 'PARTTIME',\n TEMPORARY = 'TEMPORARY'\n}\n\nregisterEnumType(EmployeeType, {\n name: 'EmployeeType',\n description: 'type enumeration of a employee'\n})\n\n@Entity()\n@Index('ix_employee_0', (employee: Employee) => [employee.domain, employee.controlNo, employee.deletedAt], {\n unique: true\n})\n@ObjectType({ description: 'Entity for Employee' })\nexport class Employee {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @VersionColumn()\n @Field({ nullable: true })\n version?: number = 1\n\n @ManyToOne(type => Domain)\n @Field(type => Domain)\n domain?: Domain\n\n @RelationId((employee: Employee) => employee.domain)\n domainId?: string\n\n @Column()\n @Field({ nullable: false })\n controlNo: string\n\n @Column()\n @Field({ nullable: true })\n name?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n alias?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n jobResponsibility?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n jobPosition?: string\n\n @ManyToOne(type => Employee, supervisor => supervisor.supervises, { nullable: true })\n @Field(type => Employee, { nullable: true })\n supervisor?: Employee\n\n @RelationId((employee: Employee) => employee.supervisor)\n supervisorId?: string\n\n @OneToMany(type => Employee, employee => employee.supervisor)\n @Field(type => [Employee])\n supervises?: Employee[]\n\n @ManyToOne(type => Department, department => department.members, { nullable: true })\n @Field(type => Department, { nullable: true })\n department?: Department\n\n @RelationId((employee: Employee) => employee.department)\n departmentId?: string\n\n @OneToMany(type => Department, department => department.manager)\n @Field(type => [Department])\n manages?: Department[]\n\n @OneToMany(type => ApprovalLine, employee => employee.ownerEmployee)\n @Field(type => [ApprovalLine])\n approvalLines?: ApprovalLine[]\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n active?: boolean\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n type?: EmployeeType\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n extension?: string\n\n @Field(type => String, { nullable: true })\n photo?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field({ nullable: true })\n user?: User\n\n @RelationId((employee: Employee) => employee.user)\n userId?: string\n\n @ManyToOne(type => Contact, { nullable: true })\n @Field({ nullable: true })\n contact?: Contact\n\n @RelationId((employee: Employee) => employee.contact)\n contactId?: string\n\n @Field(type => GraphQLEmailAddress, { nullable: true })\n email?: string\n\n @Field({ nullable: true })\n phone?: string\n\n @Field(type => Profile, { nullable: true })\n profile?: Profile\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n emergencyContact?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n emergencyContactPhone?: string\n\n /* The pay account is HR-payroll's (ADR-0139), not the roster's. */\n @Column({ nullable: true })\n @Directive('@privilege(category: \"employee-private\", privilege: \"query\", domainOwnerGranted: true)')\n @Field({ nullable: true })\n bankAccount?: string\n\n @Column({ nullable: true })\n @Directive('@privilege(category: \"employee-private\", privilege: \"query\", domainOwnerGranted: true)')\n @Field({ nullable: true })\n bankName?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n note?: string\n\n /* Calendar days, not instants: 'YYYY-MM-DD' strings, so no time zone can move them to the day before. */\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'The hire day in YYYY-MM-DD format' })\n hiredOn?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'The retire day in YYYY-MM-DD format' })\n retiredOn?: string\n\n @CreateDateColumn()\n @Field({ nullable: true })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true })\n updatedAt?: Date\n\n @DeleteDateColumn()\n @Field({ nullable: true })\n deletedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n creator?: User\n\n @RelationId((employee: Employee) => employee.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((employee: Employee) => employee.updater)\n updaterId?: string\n}\n"]}
|