@things-factory/organization 6.2.177 → 6.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/component/department-view.ts +1 -1
- package/dist-client/component/approval-line-brief.js.map +1 -1
- package/dist-client/component/approval-line-items-editor-popup.js.map +1 -1
- package/dist-client/component/approval-line-items-editor.js.map +1 -1
- package/dist-client/component/approval-line-selector.js.map +1 -1
- package/dist-client/component/approval-line-templates-manager.js.map +1 -1
- package/dist-client/component/approval-line-view.js.map +1 -1
- package/dist-client/component/assignees-editor-popup.js.map +1 -1
- package/dist-client/component/assignees-editor.js.map +1 -1
- package/dist-client/component/assignees-view.js.map +1 -1
- package/dist-client/component/department-selector.js.map +1 -1
- package/dist-client/component/department-view.js.map +1 -1
- package/dist-client/component/recipients-editor-popup.js.map +1 -1
- package/dist-client/component/recipients-editor.js.map +1 -1
- package/dist-client/component/recipients-view.js.map +1 -1
- package/dist-client/grist-editor/grist-editor-approval-line.js.map +1 -1
- package/dist-client/grist-editor/grist-editor-assignees.js.map +1 -1
- package/dist-client/grist-editor/grist-editor-department-object.js.map +1 -1
- package/dist-client/grist-editor/grist-editor-recipients.js.map +1 -1
- package/dist-client/grist-editor/grist-renderer-department-object.js.map +1 -1
- package/dist-client/pages/approval-line/common-approval-line-templates-page.js.map +1 -1
- package/dist-client/pages/approval-line/my-approval-line-templates-page.js.map +1 -1
- package/dist-client/pages/department/department-importer.js.map +1 -1
- package/dist-client/pages/department/department-list-page.js.map +1 -1
- package/dist-client/pages/department/department-tree-page.js.map +1 -1
- package/dist-client/pages/employee/employee-importer.js.map +1 -1
- package/dist-client/pages/employee/employee-list-page.js.map +1 -1
- package/dist-client/pages/employee/employees-by-department.js.map +1 -1
- package/dist-client/route.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/index.d.ts +1 -0
- package/dist-server/index.js +0 -1
- package/dist-server/index.js.map +1 -1
- package/dist-server/service/approval-line/approval-line-item.d.ts +19 -0
- package/dist-server/service/approval-line/approval-line-item.js +5 -5
- package/dist-server/service/approval-line/approval-line-item.js.map +1 -1
- package/dist-server/service/approval-line/approval-line-mutation.d.ts +15 -0
- package/dist-server/service/approval-line/approval-line-mutation.js +2 -2
- package/dist-server/service/approval-line/approval-line-mutation.js.map +1 -1
- package/dist-server/service/approval-line/approval-line-query.d.ts +17 -0
- package/dist-server/service/approval-line/approval-line-query.js +2 -2
- package/dist-server/service/approval-line/approval-line-query.js.map +1 -1
- package/dist-server/service/approval-line/approval-line-type.d.ts +26 -0
- package/dist-server/service/approval-line/approval-line-type.js +8 -8
- package/dist-server/service/approval-line/approval-line-type.js.map +1 -1
- package/dist-server/service/approval-line/approval-line.d.ts +33 -0
- package/dist-server/service/approval-line/approval-line.js +5 -5
- package/dist-server/service/approval-line/approval-line.js.map +1 -1
- package/dist-server/service/approval-line/index.d.ts +6 -0
- package/dist-server/service/department/department-history.d.ts +31 -0
- package/dist-server/service/department/department-history.js +2 -2
- package/dist-server/service/department/department-history.js.map +1 -1
- package/dist-server/service/department/department-mutation.d.ts +10 -0
- package/dist-server/service/department/department-mutation.js +2 -2
- package/dist-server/service/department/department-mutation.js.map +1 -1
- package/dist-server/service/department/department-query.d.ts +17 -0
- package/dist-server/service/department/department-query.js +2 -2
- package/dist-server/service/department/department-query.js.map +1 -1
- package/dist-server/service/department/department-type.d.ts +29 -0
- package/dist-server/service/department/department-type.js +6 -6
- package/dist-server/service/department/department-type.js.map +1 -1
- package/dist-server/service/department/department.d.ts +28 -0
- package/dist-server/service/department/department.js +6 -7
- package/dist-server/service/department/department.js.map +1 -1
- package/dist-server/service/department/event-subscriber.d.ts +7 -0
- package/dist-server/service/department/event-subscriber.js +2 -2
- package/dist-server/service/department/event-subscriber.js.map +1 -1
- package/dist-server/service/department/index.d.ts +8 -0
- package/dist-server/service/employee/employee-history.d.ts +41 -0
- package/dist-server/service/employee/employee-history.js +3 -4
- package/dist-server/service/employee/employee-history.js.map +1 -1
- package/dist-server/service/employee/employee-mutation.d.ts +12 -0
- package/dist-server/service/employee/employee-mutation.js +2 -2
- package/dist-server/service/employee/employee-mutation.js.map +1 -1
- package/dist-server/service/employee/employee-query.d.ts +22 -0
- package/dist-server/service/employee/employee-query.js +2 -2
- package/dist-server/service/employee/employee-query.js.map +1 -1
- package/dist-server/service/employee/employee-type.d.ts +56 -0
- package/dist-server/service/employee/employee-type.js +10 -10
- package/dist-server/service/employee/employee-type.js.map +1 -1
- package/dist-server/service/employee/employee.d.ts +49 -0
- package/dist-server/service/employee/employee.js +10 -12
- package/dist-server/service/employee/employee.js.map +1 -1
- package/dist-server/service/employee/event-subscriber.d.ts +7 -0
- package/dist-server/service/employee/event-subscriber.js +2 -2
- package/dist-server/service/employee/event-subscriber.js.map +1 -1
- package/dist-server/service/employee/index.d.ts +8 -0
- package/dist-server/service/index.d.ts +8 -0
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/server/index.ts +0 -2
- package/server/service/employee/employee-query.ts +1 -1
- package/dist-server/routes.js +0 -25
- package/dist-server/routes.js.map +0 -1
- package/server/routes.ts +0 -28
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"employee-history.js","sourceRoot":"","sources":["../../../server/service/employee/employee-history.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"employee-history.js","sourceRoot":"","sources":["../../../server/service/employee/employee-history.ts"],"names":[],"mappings":";;;;AAAA,+CAAoD;AACpD,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,CA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AAU,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,CAoI3B","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({ nullable: true })\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 })\n hiredOn?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n retiredAt?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n extension?: 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({ nullable: true })\n creator?: User\n\n @RelationId((employee: Employee) => employee.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field({ 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 : 'smallint',\n enum: HistoryActionType\n })\n public action!: HistoryActionType\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Employee } from './employee';
|
|
2
|
+
import { NewEmployee, EmployeePatch } from './employee-type';
|
|
3
|
+
export declare class EmployeeMutation {
|
|
4
|
+
createEmployee(employee: NewEmployee, context: ResolverContext): Promise<Employee>;
|
|
5
|
+
updateEmployee(id: string, patch: EmployeePatch, context: ResolverContext): Promise<Employee>;
|
|
6
|
+
updateMultipleEmployee(patches: EmployeePatch[], context: ResolverContext): Promise<Employee[]>;
|
|
7
|
+
deleteEmployee(id: string, context: ResolverContext): Promise<boolean>;
|
|
8
|
+
deleteEmployees(ids: string[], context: ResolverContext): Promise<boolean>;
|
|
9
|
+
importEmployees(employees: EmployeePatch[], context: ResolverContext): Promise<boolean>;
|
|
10
|
+
attachContact(id: string, contactId: string, context: ResolverContext): Promise<Employee>;
|
|
11
|
+
detachContact(id: string, context: ResolverContext): Promise<Employee>;
|
|
12
|
+
}
|
|
@@ -174,6 +174,7 @@ let EmployeeMutation = class EmployeeMutation {
|
|
|
174
174
|
return result;
|
|
175
175
|
}
|
|
176
176
|
};
|
|
177
|
+
exports.EmployeeMutation = EmployeeMutation;
|
|
177
178
|
tslib_1.__decorate([
|
|
178
179
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
179
180
|
(0, type_graphql_1.Mutation)(returns => employee_1.Employee, { description: 'To create new Employee' }),
|
|
@@ -248,8 +249,7 @@ tslib_1.__decorate([
|
|
|
248
249
|
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
|
249
250
|
tslib_1.__metadata("design:returntype", Promise)
|
|
250
251
|
], EmployeeMutation.prototype, "detachContact", null);
|
|
251
|
-
EmployeeMutation = tslib_1.__decorate([
|
|
252
|
+
exports.EmployeeMutation = EmployeeMutation = tslib_1.__decorate([
|
|
252
253
|
(0, type_graphql_1.Resolver)(employee_1.Employee)
|
|
253
254
|
], EmployeeMutation);
|
|
254
|
-
exports.EmployeeMutation = EmployeeMutation;
|
|
255
255
|
//# sourceMappingURL=employee-mutation.js.map
|
|
@@ -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,MA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IAAI,CAAC,CAAA;IAAc,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;qDAehD;AAxTU,gBAAgB;IAD5B,IAAA,uBAAQ,EAAC,mBAAQ,CAAC;GACN,gBAAgB,CAyT5B;AAzTY,4CAAgB","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"]}
|
|
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;QAC1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,kBAAG,GAAE,CAAA;;;;uDAYP;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,8BAA8B,EAAE,CAAC;IAE3E,mBAAA,IAAA,kBAAG,EAAC,WAAW,EAAE,IAAI,CAAC,EAAE,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;2BAxTU,gBAAgB;IAD5B,IAAA,uBAAQ,EAAC,mBAAQ,CAAC;GACN,gBAAgB,CAyT5B","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"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Domain, ListParam } from '@things-factory/shell';
|
|
2
|
+
import { User } from '@things-factory/auth-base';
|
|
3
|
+
import { Contact, Profile } from '@things-factory/contact';
|
|
4
|
+
import { Employee } from './employee';
|
|
5
|
+
import { EmployeeList } from './employee-type';
|
|
6
|
+
import { Department } from '../department/department';
|
|
7
|
+
export declare class EmployeeQuery {
|
|
8
|
+
employee(id: string, context: ResolverContext): Promise<Employee>;
|
|
9
|
+
employees(params: ListParam, context: ResolverContext): Promise<EmployeeList>;
|
|
10
|
+
photo(employee: Employee): Promise<string | undefined>;
|
|
11
|
+
phone(employee: Employee, context: ResolverContext): Promise<string>;
|
|
12
|
+
address(employee: Employee, context: ResolverContext): Promise<string>;
|
|
13
|
+
email(employee: Employee, context: ResolverContext): Promise<string>;
|
|
14
|
+
profile(employee: Employee): Promise<Profile>;
|
|
15
|
+
department(employee: Employee): Promise<Department>;
|
|
16
|
+
user(employee: Employee): Promise<User>;
|
|
17
|
+
supervisor(employee: Employee): Promise<Employee>;
|
|
18
|
+
contact(employee: Employee): Promise<Contact>;
|
|
19
|
+
domain(employee: Employee): Promise<Domain>;
|
|
20
|
+
updater(employee: Employee): Promise<User>;
|
|
21
|
+
creator(employee: Employee): Promise<User>;
|
|
22
|
+
}
|
|
@@ -120,6 +120,7 @@ let EmployeeQuery = class EmployeeQuery {
|
|
|
120
120
|
return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: employee.creatorId });
|
|
121
121
|
}
|
|
122
122
|
};
|
|
123
|
+
exports.EmployeeQuery = EmployeeQuery;
|
|
123
124
|
tslib_1.__decorate([
|
|
124
125
|
(0, type_graphql_1.Query)(returns => employee_1.Employee, { nullable: true, description: 'To fetch a Employee' }),
|
|
125
126
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
@@ -223,8 +224,7 @@ tslib_1.__decorate([
|
|
|
223
224
|
tslib_1.__metadata("design:paramtypes", [employee_1.Employee]),
|
|
224
225
|
tslib_1.__metadata("design:returntype", Promise)
|
|
225
226
|
], EmployeeQuery.prototype, "creator", null);
|
|
226
|
-
EmployeeQuery = tslib_1.__decorate([
|
|
227
|
+
exports.EmployeeQuery = EmployeeQuery = tslib_1.__decorate([
|
|
227
228
|
(0, type_graphql_1.Resolver)(employee_1.Employee)
|
|
228
229
|
], EmployeeQuery);
|
|
229
|
-
exports.EmployeeQuery = EmployeeQuery;
|
|
230
230
|
//# sourceMappingURL=employee-query.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"employee-query.js","sourceRoot":"","sources":["../../../server/service/employee/employee-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAC9F,qEAA4D;AAC5D,iDAAuG;AACvG,yDAAgD;AAChD,qDAAqF;AACrF,yCAAqC;AACrC,mDAA8C;AAC9C,yDAAqD;AAErD,KAAK,UAAU,cAAc,CAAC,SAAiB,EAAE,IAAY,EAAE,KAAa,EAAE,OAAwB;;IACpG,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;IAChC,MAAM,OAAO,GAAY,MAAM,IAAA,qBAAa,EAAC,iBAAO,CAAC,CAAC,OAAO,CAAC,EAAE,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AAI,GAAE,CAAA;;6CAAW,mBAAQ;;yCAIpC;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,mBAAQ,CAAC;IACd,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAW,mBAAQ;;+CAI1C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAO,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAW,mBAAQ;;4CAIvC;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAW,mBAAQ;;2CAEtC;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAW,mBAAQ;;4CAEvC;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAW,mBAAQ;;4CAEvC;AA1IU,aAAa;IADzB,IAAA,uBAAQ,EAAC,mBAAQ,CAAC;GACN,aAAa,CA2IzB;AA3IY,sCAAa","sourcesContent":["import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'\nimport { Attachment } from '@things-factory/attachment-base'\nimport { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { Contact, ContactItem, ContactField, Profile } from '@things-factory/contact'\nimport { Employee } from './employee'\nimport { EmployeeList } from './employee-type'\nimport { Department } from '../department/department'\n\nasync function getContactItem(contactId: String, type: String, label: String, context: ResolverContext) {\n const { domain } = context.state\n const contact: Contact = await getRepository(Contact).findOne({ where: { domain: { id: domain.id }, id: contactId } })\n const { items } = contact\n\n if (!items || !(items instanceof Array)) {\n return ''\n }\n\n return items?.find(item => item.type === type && item.label === label)?.value || ''\n}\n@Resolver(Employee)\nexport class EmployeeQuery {\n @Query(returns => Employee!, { nullable: true, description: 'To fetch a Employee' })\n async employee(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Employee> {\n const { domain } = context.state\n\n return await getRepository(Employee).findOne({\n where: { domain: { id: domain.id }, id }\n })\n }\n\n @Query(returns => EmployeeList, { description: 'To fetch multiple Employees' })\n async employees(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<EmployeeList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(Employee),\n searchables: ['name', 'controlNo', 'alias']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n \n return { items, total }\n }\n\n @FieldResolver(type => String)\n async photo(@Root() employee: Employee): Promise<string | undefined> {\n const attachment: Attachment = await getRepository(Attachment).findOne({\n where: {\n domain: { id: employee.domainId },\n refType: Employee.name,\n refBy: employee.id\n }\n })\n\n return attachment?.fullpath\n }\n\n @FieldResolver(type => String)\n async phone(@Root() employee: Employee, @Ctx() context: ResolverContext): Promise<string> {\n if (!employee.contactId) {\n return\n }\n\n await getContactItem(employee.contactId, ContactField.Phone, 'work', context)\n }\n\n @FieldResolver(type => String)\n async address(@Root() employee: Employee, @Ctx() context: ResolverContext): Promise<string> {\n if (!employee.contactId) {\n return\n }\n\n await getContactItem(employee.contactId, ContactField.Address, 'work', context)\n }\n\n @FieldResolver(type => String)\n async email(@Root() employee: Employee, @Ctx() context: ResolverContext): Promise<string> {\n if (!employee.contactId) {\n return\n }\n\n await getContactItem(employee.contactId, ContactField.Email, 'work', context)\n }\n\n @FieldResolver(type => Profile)\n async profile(@Root() employee: Employee): Promise<Profile> {\n if (!employee.contactId) {\n return\n }\n\n var contact: Contact = employee.contact\n if (!contact) {\n contact = await getRepository(Contact).findOneBy({\n id: employee.contactId\n })\n\n if (!contact) {\n return\n }\n }\n\n const { id: refBy } = contact\n const { left, top, zoom } = contact.profile || {}\n\n const attachment: Attachment = await getRepository(Attachment).findOne({\n where: {\n domain: { id: contact.domainId },\n refType: Contact.name,\n refBy\n }\n })\n\n return { left, top, zoom, picture: attachment?.fullpath }\n }\n\n @FieldResolver(type => Department)\n async department(@Root() employee: Employee): Promise<Department> {\n if (employee.departmentId) {\n return await getRepository(Department).findOneBy({ id: employee.departmentId })\n }\n }\n\n @FieldResolver(type => User)\n async user(@Root() employee: Employee): Promise<User> {\n if (employee.userId) {\n return await getRepository(User).findOneBy({ id: employee.userId })\n }\n }\n\n @FieldResolver(type => Employee)\n async supervisor(@Root() employee: Employee): Promise<Employee> {\n if (employee.supervisorId) {\n return await getRepository(Employee).findOneBy({ id: employee.supervisorId })\n }\n }\n\n @FieldResolver(type => Contact)\n async contact(@Root() employee: Employee): Promise<Contact> {\n if (employee.contactId) {\n return await getRepository(Contact).findOneBy({ id: employee.contactId })\n }\n }\n\n @FieldResolver(type => Domain)\n async domain(@Root() employee: Employee): Promise<Domain> {\n return await getRepository(Domain).findOneBy({ id: employee.domainId })\n }\n\n @FieldResolver(type => User)\n async updater(@Root() employee: Employee): Promise<User> {\n return await getRepository(User).findOneBy({ id: employee.updaterId })\n }\n\n @FieldResolver(type => User)\n async creator(@Root() employee: Employee): Promise<User> {\n return await getRepository(User).findOneBy({ id: employee.creatorId })\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"employee-query.js","sourceRoot":"","sources":["../../../server/service/employee/employee-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAC9F,qEAA4D;AAC5D,iDAAuG;AACvG,yDAAgD;AAChD,qDAAqF;AACrF,yCAAqC;AACrC,mDAA8C;AAC9C,yDAAqD;AAErD,KAAK,UAAU,cAAc,CAAC,SAAiB,EAAE,IAAY,EAAE,KAAa,EAAE,OAAwB;;IACpG,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;IAChC,MAAM,OAAO,GAAY,MAAM,IAAA,qBAAa,EAAC,iBAAO,CAAC,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AAC,uBAAU,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAW,mBAAQ;;+CAI1C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAW,mBAAQ;;yCAIpC;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,mBAAQ,CAAC;IACd,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAW,mBAAQ;;+CAI1C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAO,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAW,mBAAQ;;4CAIvC;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAW,mBAAQ;;2CAEtC;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAW,mBAAQ;;4CAEvC;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAW,mBAAQ;;4CAEvC;wBA1IU,aAAa;IADzB,IAAA,uBAAQ,EAAC,mBAAQ,CAAC;GACN,aAAa,CA2IzB","sourcesContent":["import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'\nimport { Attachment } from '@things-factory/attachment-base'\nimport { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { Contact, ContactItem, ContactField, Profile } from '@things-factory/contact'\nimport { Employee } from './employee'\nimport { EmployeeList } from './employee-type'\nimport { Department } from '../department/department'\n\nasync function getContactItem(contactId: String, type: String, label: String, context: ResolverContext) {\n const { domain } = context.state\n const contact: Contact = await getRepository(Contact).findOne({ where: { domain: { id: domain.id }, id: contactId as any } })\n const { items } = contact\n\n if (!items || !(items instanceof Array)) {\n return ''\n }\n\n return items?.find(item => item.type === type && item.label === label)?.value || ''\n}\n@Resolver(Employee)\nexport class EmployeeQuery {\n @Query(returns => Employee!, { nullable: true, description: 'To fetch a Employee' })\n async employee(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Employee> {\n const { domain } = context.state\n\n return await getRepository(Employee).findOne({\n where: { domain: { id: domain.id }, id }\n })\n }\n\n @Query(returns => EmployeeList, { description: 'To fetch multiple Employees' })\n async employees(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<EmployeeList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(Employee),\n searchables: ['name', 'controlNo', 'alias']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n \n return { items, total }\n }\n\n @FieldResolver(type => String)\n async photo(@Root() employee: Employee): Promise<string | undefined> {\n const attachment: Attachment = await getRepository(Attachment).findOne({\n where: {\n domain: { id: employee.domainId },\n refType: Employee.name,\n refBy: employee.id\n }\n })\n\n return attachment?.fullpath\n }\n\n @FieldResolver(type => String)\n async phone(@Root() employee: Employee, @Ctx() context: ResolverContext): Promise<string> {\n if (!employee.contactId) {\n return\n }\n\n await getContactItem(employee.contactId, ContactField.Phone, 'work', context)\n }\n\n @FieldResolver(type => String)\n async address(@Root() employee: Employee, @Ctx() context: ResolverContext): Promise<string> {\n if (!employee.contactId) {\n return\n }\n\n await getContactItem(employee.contactId, ContactField.Address, 'work', context)\n }\n\n @FieldResolver(type => String)\n async email(@Root() employee: Employee, @Ctx() context: ResolverContext): Promise<string> {\n if (!employee.contactId) {\n return\n }\n\n await getContactItem(employee.contactId, ContactField.Email, 'work', context)\n }\n\n @FieldResolver(type => Profile)\n async profile(@Root() employee: Employee): Promise<Profile> {\n if (!employee.contactId) {\n return\n }\n\n var contact: Contact = employee.contact\n if (!contact) {\n contact = await getRepository(Contact).findOneBy({\n id: employee.contactId\n })\n\n if (!contact) {\n return\n }\n }\n\n const { id: refBy } = contact\n const { left, top, zoom } = contact.profile || {}\n\n const attachment: Attachment = await getRepository(Attachment).findOne({\n where: {\n domain: { id: contact.domainId },\n refType: Contact.name,\n refBy\n }\n })\n\n return { left, top, zoom, picture: attachment?.fullpath }\n }\n\n @FieldResolver(type => Department)\n async department(@Root() employee: Employee): Promise<Department> {\n if (employee.departmentId) {\n return await getRepository(Department).findOneBy({ id: employee.departmentId })\n }\n }\n\n @FieldResolver(type => User)\n async user(@Root() employee: Employee): Promise<User> {\n if (employee.userId) {\n return await getRepository(User).findOneBy({ id: employee.userId })\n }\n }\n\n @FieldResolver(type => Employee)\n async supervisor(@Root() employee: Employee): Promise<Employee> {\n if (employee.supervisorId) {\n return await getRepository(Employee).findOneBy({ id: employee.supervisorId })\n }\n }\n\n @FieldResolver(type => Contact)\n async contact(@Root() employee: Employee): Promise<Contact> {\n if (employee.contactId) {\n return await getRepository(Contact).findOneBy({ id: employee.contactId })\n }\n }\n\n @FieldResolver(type => Domain)\n async domain(@Root() employee: Employee): Promise<Domain> {\n return await getRepository(Domain).findOneBy({ id: employee.domainId })\n }\n\n @FieldResolver(type => User)\n async updater(@Root() employee: Employee): Promise<User> {\n return await getRepository(User).findOneBy({ id: employee.updaterId })\n }\n\n @FieldResolver(type => User)\n async creator(@Root() employee: Employee): Promise<User> {\n return await getRepository(User).findOneBy({ id: employee.creatorId })\n }\n}\n"]}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { FileUpload } from 'graphql-upload/GraphQLUpload.js';
|
|
2
|
+
import { ObjectRef } from '@things-factory/shell';
|
|
3
|
+
import { Employee, EmployeeType } from './employee';
|
|
4
|
+
export declare class ObjectRefForEmployee extends ObjectRef {
|
|
5
|
+
controlNo?: string;
|
|
6
|
+
type?: EmployeeType;
|
|
7
|
+
alias?: string;
|
|
8
|
+
photo?: string;
|
|
9
|
+
email?: string;
|
|
10
|
+
jobPosition?: string;
|
|
11
|
+
jobResponsibility?: string;
|
|
12
|
+
hiredOn?: string;
|
|
13
|
+
active?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare class ObjectRefForUser extends ObjectRef {
|
|
16
|
+
email?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare class NewEmployee {
|
|
19
|
+
controlNo: string;
|
|
20
|
+
name: string;
|
|
21
|
+
alias?: string;
|
|
22
|
+
jobResponsibility?: string;
|
|
23
|
+
jobPosition?: string;
|
|
24
|
+
type?: EmployeeType;
|
|
25
|
+
active?: boolean;
|
|
26
|
+
extension?: string;
|
|
27
|
+
hiredOn?: string;
|
|
28
|
+
retiredAt?: string;
|
|
29
|
+
photo?: FileUpload;
|
|
30
|
+
note?: string;
|
|
31
|
+
supervisor?: ObjectRefForEmployee;
|
|
32
|
+
department?: ObjectRef;
|
|
33
|
+
user?: ObjectRefForUser;
|
|
34
|
+
}
|
|
35
|
+
export declare class EmployeePatch {
|
|
36
|
+
id?: string;
|
|
37
|
+
controlNo?: string;
|
|
38
|
+
name?: string;
|
|
39
|
+
alias?: string;
|
|
40
|
+
jobResponsibility?: string;
|
|
41
|
+
jobPosition?: string;
|
|
42
|
+
type?: EmployeeType;
|
|
43
|
+
active?: boolean;
|
|
44
|
+
hiredOn?: string;
|
|
45
|
+
retiredAt?: string;
|
|
46
|
+
photo?: FileUpload;
|
|
47
|
+
note?: string;
|
|
48
|
+
supervisor?: ObjectRefForEmployee;
|
|
49
|
+
department?: ObjectRef;
|
|
50
|
+
user?: ObjectRefForUser;
|
|
51
|
+
cuFlag?: string;
|
|
52
|
+
}
|
|
53
|
+
export declare class EmployeeList {
|
|
54
|
+
items: Employee[];
|
|
55
|
+
total: number;
|
|
56
|
+
}
|
|
@@ -9,6 +9,7 @@ const shell_1 = require("@things-factory/shell");
|
|
|
9
9
|
const employee_1 = require("./employee");
|
|
10
10
|
let ObjectRefForEmployee = class ObjectRefForEmployee extends shell_1.ObjectRef {
|
|
11
11
|
};
|
|
12
|
+
exports.ObjectRefForEmployee = ObjectRefForEmployee;
|
|
12
13
|
tslib_1.__decorate([
|
|
13
14
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
14
15
|
tslib_1.__metadata("design:type", String)
|
|
@@ -45,22 +46,22 @@ tslib_1.__decorate([
|
|
|
45
46
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
46
47
|
tslib_1.__metadata("design:type", Boolean)
|
|
47
48
|
], ObjectRefForEmployee.prototype, "active", void 0);
|
|
48
|
-
ObjectRefForEmployee = tslib_1.__decorate([
|
|
49
|
+
exports.ObjectRefForEmployee = ObjectRefForEmployee = tslib_1.__decorate([
|
|
49
50
|
(0, type_graphql_1.InputType)()
|
|
50
51
|
], ObjectRefForEmployee);
|
|
51
|
-
exports.ObjectRefForEmployee = ObjectRefForEmployee;
|
|
52
52
|
let ObjectRefForUser = class ObjectRefForUser extends shell_1.ObjectRef {
|
|
53
53
|
};
|
|
54
|
+
exports.ObjectRefForUser = ObjectRefForUser;
|
|
54
55
|
tslib_1.__decorate([
|
|
55
56
|
(0, type_graphql_1.Field)(type => graphql_scalars_1.GraphQLEmailAddress, { nullable: true }),
|
|
56
57
|
tslib_1.__metadata("design:type", String)
|
|
57
58
|
], ObjectRefForUser.prototype, "email", void 0);
|
|
58
|
-
ObjectRefForUser = tslib_1.__decorate([
|
|
59
|
+
exports.ObjectRefForUser = ObjectRefForUser = tslib_1.__decorate([
|
|
59
60
|
(0, type_graphql_1.InputType)()
|
|
60
61
|
], ObjectRefForUser);
|
|
61
|
-
exports.ObjectRefForUser = ObjectRefForUser;
|
|
62
62
|
let NewEmployee = class NewEmployee {
|
|
63
63
|
};
|
|
64
|
+
exports.NewEmployee = NewEmployee;
|
|
64
65
|
tslib_1.__decorate([
|
|
65
66
|
(0, type_graphql_1.Field)(),
|
|
66
67
|
tslib_1.__metadata("design:type", String)
|
|
@@ -121,12 +122,12 @@ tslib_1.__decorate([
|
|
|
121
122
|
(0, type_graphql_1.Field)(type => ObjectRefForUser, { nullable: true }),
|
|
122
123
|
tslib_1.__metadata("design:type", ObjectRefForUser)
|
|
123
124
|
], NewEmployee.prototype, "user", void 0);
|
|
124
|
-
NewEmployee = tslib_1.__decorate([
|
|
125
|
+
exports.NewEmployee = NewEmployee = tslib_1.__decorate([
|
|
125
126
|
(0, type_graphql_1.InputType)()
|
|
126
127
|
], NewEmployee);
|
|
127
|
-
exports.NewEmployee = NewEmployee;
|
|
128
128
|
let EmployeePatch = class EmployeePatch {
|
|
129
129
|
};
|
|
130
|
+
exports.EmployeePatch = EmployeePatch;
|
|
130
131
|
tslib_1.__decorate([
|
|
131
132
|
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true }),
|
|
132
133
|
tslib_1.__metadata("design:type", String)
|
|
@@ -191,12 +192,12 @@ tslib_1.__decorate([
|
|
|
191
192
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
192
193
|
tslib_1.__metadata("design:type", String)
|
|
193
194
|
], EmployeePatch.prototype, "cuFlag", void 0);
|
|
194
|
-
EmployeePatch = tslib_1.__decorate([
|
|
195
|
+
exports.EmployeePatch = EmployeePatch = tslib_1.__decorate([
|
|
195
196
|
(0, type_graphql_1.InputType)()
|
|
196
197
|
], EmployeePatch);
|
|
197
|
-
exports.EmployeePatch = EmployeePatch;
|
|
198
198
|
let EmployeeList = class EmployeeList {
|
|
199
199
|
};
|
|
200
|
+
exports.EmployeeList = EmployeeList;
|
|
200
201
|
tslib_1.__decorate([
|
|
201
202
|
(0, type_graphql_1.Field)(type => [employee_1.Employee]),
|
|
202
203
|
tslib_1.__metadata("design:type", Array)
|
|
@@ -205,8 +206,7 @@ tslib_1.__decorate([
|
|
|
205
206
|
(0, type_graphql_1.Field)(type => type_graphql_1.Int),
|
|
206
207
|
tslib_1.__metadata("design:type", Number)
|
|
207
208
|
], EmployeeList.prototype, "total", void 0);
|
|
208
|
-
EmployeeList = tslib_1.__decorate([
|
|
209
|
+
exports.EmployeeList = EmployeeList = tslib_1.__decorate([
|
|
209
210
|
(0, type_graphql_1.ObjectType)()
|
|
210
211
|
], EmployeeList);
|
|
211
|
-
exports.EmployeeList = EmployeeList;
|
|
212
212
|
//# sourceMappingURL=employee-type.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"employee-type.js","sourceRoot":"","sources":["../../../server/service/employee/employee-type.ts"],"names":[],"mappings":";;;;AACA,+FAA2D;AAC3D,+CAAsF;AACtF,qDAAqD;AAErD,iDAA+D;AAE/D,yCAAmD;AAG5C,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,iBAAS;CA2BlD,CAAA;
|
|
1
|
+
{"version":3,"file":"employee-type.js","sourceRoot":"","sources":["../../../server/service/employee/employee-type.ts"],"names":[],"mappings":";;;;AACA,+FAA2D;AAC3D,+CAAsF;AACtF,qDAAqD;AAErD,iDAA+D;AAE/D,yCAAmD;AAG5C,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,iBAAS;CA2BlD,CAAA;AA3BY,oDAAoB;AAE/B;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;uDACR;AAGlB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,uBAAY,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kDAC7B;AAGnB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDACZ;AAGd;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDACZ;AAGd;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,qCAAmB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDACzC;AAGd;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,C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K,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,mBAAQ,CAAC,CAAC;;2CACT;AAGjB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;2CACN;uBALF,YAAY;IADxB,IAAA,yBAAU,GAAE;GACA,YAAY,CAMxB","sourcesContent":["import type { FileUpload } from 'graphql-upload/GraphQLUpload.js'\nimport GraphQLUpload from 'graphql-upload/GraphQLUpload.js'\nimport { ObjectType, Field, InputType, Int, ID, registerEnumType } from 'type-graphql'\nimport { GraphQLEmailAddress } from 'graphql-scalars'\n\nimport { ObjectRef, ScalarObject } from '@things-factory/shell'\n\nimport { Employee, EmployeeType } from './employee'\n\n@InputType()\nexport class ObjectRefForEmployee extends ObjectRef {\n @Field({ nullable: true })\n controlNo?: string\n\n @Field(type => EmployeeType, { nullable: true })\n type?: EmployeeType\n\n @Field({ nullable: true })\n alias?: string\n\n @Field({ nullable: true })\n photo?: string\n\n @Field(type => GraphQLEmailAddress, { nullable: true })\n email?: string\n\n @Field({ nullable: true })\n jobPosition?: string\n\n @Field({ nullable: true })\n jobResponsibility?: string\n\n @Field({ nullable: true })\n hiredOn?: string\n\n @Field({ nullable: true })\n active?: boolean\n}\n\n@InputType()\nexport class ObjectRefForUser extends ObjectRef {\n @Field(type => GraphQLEmailAddress, { nullable: true })\n email?: string\n}\n\n@InputType()\nexport class NewEmployee {\n @Field()\n controlNo: string\n\n @Field()\n name: string\n\n @Field({ nullable: true })\n alias?: string\n\n @Field({ nullable: true })\n jobResponsibility?: string\n\n @Field({ nullable: true })\n jobPosition?: string\n\n @Field(type => EmployeeType, { nullable: true })\n type?: EmployeeType\n\n @Field({ nullable: true })\n active?: boolean\n\n @Field({ nullable: true })\n extension?: string\n\n @Field({ nullable: true })\n hiredOn?: string\n\n @Field({ nullable: true })\n retiredAt?: string\n\n @Field(type => GraphQLUpload, { nullable: true })\n photo?: FileUpload\n\n @Field({ nullable: true })\n note?: string\n\n @Field(type => ObjectRefForEmployee, { nullable: true })\n supervisor?: ObjectRefForEmployee\n\n @Field(type => ObjectRef, { nullable: true })\n department?: ObjectRef\n\n @Field(type => ObjectRefForUser, { nullable: true })\n user?: ObjectRefForUser\n}\n\n@InputType()\nexport class EmployeePatch {\n @Field(type => ID, { nullable: true })\n id?: string\n\n @Field({ nullable: true })\n controlNo?: string\n\n @Field({ nullable: true })\n name?: string\n\n @Field({ nullable: true })\n alias?: string\n\n @Field({ nullable: true })\n jobResponsibility?: string\n\n @Field({ nullable: true })\n jobPosition?: string\n\n @Field(type => EmployeeType, { nullable: true })\n type?: EmployeeType\n\n @Field({ nullable: true })\n active?: boolean\n\n @Field({ nullable: true })\n hiredOn?: string\n\n @Field({ nullable: true })\n retiredAt?: string\n\n @Field(type => GraphQLUpload, { nullable: true })\n photo?: FileUpload\n\n @Field({ nullable: true })\n note?: string\n\n @Field(type => ObjectRefForEmployee, { nullable: true })\n supervisor?: ObjectRefForEmployee\n\n @Field(type => ObjectRef, { nullable: true })\n department?: ObjectRef\n\n @Field(type => ObjectRefForUser, { nullable: true })\n user?: ObjectRefForUser\n\n @Field({ nullable: true })\n cuFlag?: string\n}\n\n@ObjectType()\nexport class EmployeeList {\n @Field(type => [Employee])\n items: Employee[]\n\n @Field(type => Int)\n total: number\n}\n"]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Domain } from '@things-factory/shell';
|
|
2
|
+
import { User } from '@things-factory/auth-base';
|
|
3
|
+
import { Contact, Profile } from '@things-factory/contact';
|
|
4
|
+
import { Department } from '../department/department';
|
|
5
|
+
import { ApprovalLine } from '../approval-line/approval-line';
|
|
6
|
+
export declare enum EmployeeType {
|
|
7
|
+
FULLTIME = "FULLTIME",
|
|
8
|
+
PARTTIME = "PARTTIME",
|
|
9
|
+
TEMPORARY = "TEMPORARY"
|
|
10
|
+
}
|
|
11
|
+
export declare class Employee {
|
|
12
|
+
readonly id: string;
|
|
13
|
+
version?: number;
|
|
14
|
+
domain?: Domain;
|
|
15
|
+
domainId?: string;
|
|
16
|
+
controlNo: string;
|
|
17
|
+
name?: string;
|
|
18
|
+
alias?: string;
|
|
19
|
+
jobResponsibility?: string;
|
|
20
|
+
jobPosition?: string;
|
|
21
|
+
supervisor?: Employee;
|
|
22
|
+
supervisorId?: string;
|
|
23
|
+
supervises?: Employee[];
|
|
24
|
+
department?: Department;
|
|
25
|
+
departmentId?: string;
|
|
26
|
+
manages?: Department[];
|
|
27
|
+
approvalLines?: ApprovalLine[];
|
|
28
|
+
active?: boolean;
|
|
29
|
+
type?: EmployeeType;
|
|
30
|
+
extension?: string;
|
|
31
|
+
photo?: string;
|
|
32
|
+
user?: User;
|
|
33
|
+
userId?: string;
|
|
34
|
+
contact?: Contact;
|
|
35
|
+
contactId?: string;
|
|
36
|
+
email?: string;
|
|
37
|
+
phone?: string;
|
|
38
|
+
profile?: Profile;
|
|
39
|
+
note?: string;
|
|
40
|
+
hiredOn?: string;
|
|
41
|
+
retiredAt?: string;
|
|
42
|
+
createdAt?: Date;
|
|
43
|
+
updatedAt?: Date;
|
|
44
|
+
deletedAt?: Date;
|
|
45
|
+
creator?: User;
|
|
46
|
+
creatorId?: string;
|
|
47
|
+
updater?: User;
|
|
48
|
+
updaterId?: string;
|
|
49
|
+
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var Employee_1;
|
|
3
|
-
var _a, _b;
|
|
4
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
3
|
exports.Employee = exports.EmployeeType = void 0;
|
|
6
4
|
const tslib_1 = require("tslib");
|
|
@@ -17,16 +15,17 @@ var EmployeeType;
|
|
|
17
15
|
EmployeeType["FULLTIME"] = "FULLTIME";
|
|
18
16
|
EmployeeType["PARTTIME"] = "PARTTIME";
|
|
19
17
|
EmployeeType["TEMPORARY"] = "TEMPORARY";
|
|
20
|
-
})(EmployeeType
|
|
18
|
+
})(EmployeeType || (exports.EmployeeType = EmployeeType = {}));
|
|
21
19
|
(0, type_graphql_1.registerEnumType)(EmployeeType, {
|
|
22
20
|
name: 'EmployeeType',
|
|
23
21
|
description: 'type enumeration of a employee'
|
|
24
22
|
});
|
|
25
|
-
let Employee =
|
|
23
|
+
let Employee = class Employee {
|
|
26
24
|
constructor() {
|
|
27
25
|
this.version = 1;
|
|
28
26
|
}
|
|
29
27
|
};
|
|
28
|
+
exports.Employee = Employee;
|
|
30
29
|
tslib_1.__decorate([
|
|
31
30
|
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
32
31
|
(0, type_graphql_1.Field)(type => type_graphql_1.ID),
|
|
@@ -72,8 +71,8 @@ tslib_1.__decorate([
|
|
|
72
71
|
tslib_1.__metadata("design:type", String)
|
|
73
72
|
], Employee.prototype, "jobPosition", void 0);
|
|
74
73
|
tslib_1.__decorate([
|
|
75
|
-
(0, typeorm_1.ManyToOne)(type =>
|
|
76
|
-
(0, type_graphql_1.Field)(type =>
|
|
74
|
+
(0, typeorm_1.ManyToOne)(type => Employee, supervisor => supervisor.supervises, { nullable: true }),
|
|
75
|
+
(0, type_graphql_1.Field)(type => Employee, { nullable: true }),
|
|
77
76
|
tslib_1.__metadata("design:type", Employee)
|
|
78
77
|
], Employee.prototype, "supervisor", void 0);
|
|
79
78
|
tslib_1.__decorate([
|
|
@@ -81,8 +80,8 @@ tslib_1.__decorate([
|
|
|
81
80
|
tslib_1.__metadata("design:type", String)
|
|
82
81
|
], Employee.prototype, "supervisorId", void 0);
|
|
83
82
|
tslib_1.__decorate([
|
|
84
|
-
(0, typeorm_1.OneToMany)(type =>
|
|
85
|
-
(0, type_graphql_1.Field)(type => [
|
|
83
|
+
(0, typeorm_1.OneToMany)(type => Employee, employee => employee.supervisor),
|
|
84
|
+
(0, type_graphql_1.Field)(type => [Employee]),
|
|
86
85
|
tslib_1.__metadata("design:type", Array)
|
|
87
86
|
], Employee.prototype, "supervises", void 0);
|
|
88
87
|
tslib_1.__decorate([
|
|
@@ -135,7 +134,7 @@ tslib_1.__decorate([
|
|
|
135
134
|
tslib_1.__decorate([
|
|
136
135
|
(0, typeorm_1.ManyToOne)(type => contact_1.Contact, { nullable: true }),
|
|
137
136
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
138
|
-
tslib_1.__metadata("design:type",
|
|
137
|
+
tslib_1.__metadata("design:type", contact_1.Contact)
|
|
139
138
|
], Employee.prototype, "contact", void 0);
|
|
140
139
|
tslib_1.__decorate([
|
|
141
140
|
(0, typeorm_1.RelationId)((employee) => employee.contact),
|
|
@@ -151,7 +150,7 @@ tslib_1.__decorate([
|
|
|
151
150
|
], Employee.prototype, "phone", void 0);
|
|
152
151
|
tslib_1.__decorate([
|
|
153
152
|
(0, type_graphql_1.Field)(type => contact_1.Profile, { nullable: true }),
|
|
154
|
-
tslib_1.__metadata("design:type",
|
|
153
|
+
tslib_1.__metadata("design:type", contact_1.Profile)
|
|
155
154
|
], Employee.prototype, "profile", void 0);
|
|
156
155
|
tslib_1.__decorate([
|
|
157
156
|
(0, typeorm_1.Column)({ nullable: true }),
|
|
@@ -201,12 +200,11 @@ tslib_1.__decorate([
|
|
|
201
200
|
(0, typeorm_1.RelationId)((employee) => employee.updater),
|
|
202
201
|
tslib_1.__metadata("design:type", String)
|
|
203
202
|
], Employee.prototype, "updaterId", void 0);
|
|
204
|
-
Employee =
|
|
203
|
+
exports.Employee = Employee = tslib_1.__decorate([
|
|
205
204
|
(0, typeorm_1.Entity)(),
|
|
206
205
|
(0, typeorm_1.Index)('ix_employee_0', (employee) => [employee.domain, employee.controlNo, employee.deletedAt], {
|
|
207
206
|
unique: true
|
|
208
207
|
}),
|
|
209
208
|
(0, type_graphql_1.ObjectType)({ description: 'Entity for Employee' })
|
|
210
209
|
], Employee);
|
|
211
|
-
exports.Employee = Employee;
|
|
212
210
|
//# sourceMappingURL=employee.js.map
|