@things-factory/organization 10.1.277 → 10.1.279

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/dist-server/service/employee-profile/index.d.ts +1 -1
  2. package/dist-server/service/index.d.ts +2 -2
  3. package/package.json +24 -8
  4. package/CHANGELOG.md +0 -8
  5. package/dist-client/bootstrap.js.map +0 -1
  6. package/dist-client/component/approval-line-brief.js.map +0 -1
  7. package/dist-client/component/approval-line-edit.js.map +0 -1
  8. package/dist-client/component/approval-line-items-editor-popup.js.map +0 -1
  9. package/dist-client/component/approval-line-items-editor.js.map +0 -1
  10. package/dist-client/component/approval-line-selector.js.map +0 -1
  11. package/dist-client/component/approval-line-templates-manager.js.map +0 -1
  12. package/dist-client/component/approval-line-view.js.map +0 -1
  13. package/dist-client/component/assignees-editor-popup.js.map +0 -1
  14. package/dist-client/component/assignees-editor.js.map +0 -1
  15. package/dist-client/component/assignees-view.js.map +0 -1
  16. package/dist-client/component/copy-from.js.map +0 -1
  17. package/dist-client/component/department-selector.js.map +0 -1
  18. package/dist-client/component/department-view.js.map +0 -1
  19. package/dist-client/component/index.js.map +0 -1
  20. package/dist-client/component/popup-actions-row.test.d.ts +0 -1
  21. package/dist-client/component/popup-actions-row.test.js +0 -42
  22. package/dist-client/component/popup-actions-row.test.js.map +0 -1
  23. package/dist-client/component/recipients-editor-popup.js.map +0 -1
  24. package/dist-client/component/recipients-editor.js.map +0 -1
  25. package/dist-client/component/recipients-view.js.map +0 -1
  26. package/dist-client/entity360/department-360.js.map +0 -1
  27. package/dist-client/entity360/person-membership-section.js.map +0 -1
  28. package/dist-client/filters-form/filter-department-object.js.map +0 -1
  29. package/dist-client/filters-form/ox-filter-department-object.js.map +0 -1
  30. package/dist-client/grist-editor/grist-editor-approval-line.js.map +0 -1
  31. package/dist-client/grist-editor/grist-editor-assignees.js.map +0 -1
  32. package/dist-client/grist-editor/grist-editor-department-object.js.map +0 -1
  33. package/dist-client/grist-editor/grist-editor-recipients.js.map +0 -1
  34. package/dist-client/grist-editor/grist-renderer-approval-line.js.map +0 -1
  35. package/dist-client/grist-editor/grist-renderer-assignees.js.map +0 -1
  36. package/dist-client/grist-editor/grist-renderer-department-object.js.map +0 -1
  37. package/dist-client/grist-editor/grist-renderer-recipients.js.map +0 -1
  38. package/dist-client/index.js.map +0 -1
  39. package/dist-client/my-picture-model.js.map +0 -1
  40. package/dist-client/my-picture.js.map +0 -1
  41. package/dist-client/pages/approval-line/approval-line-list-page.js.map +0 -1
  42. package/dist-client/pages/approval-line/common-approval-line-templates-page.js.map +0 -1
  43. package/dist-client/pages/approval-line/my-approval-line-templates-page.js.map +0 -1
  44. package/dist-client/pages/department/department-importer.js.map +0 -1
  45. package/dist-client/pages/department/department-list-page.js.map +0 -1
  46. package/dist-client/pages/department/department-patch.js.map +0 -1
  47. package/dist-client/pages/employee/employee-importer.js.map +0 -1
  48. package/dist-client/pages/employee/employee-list-page.js.map +0 -1
  49. package/dist-client/pages/employee-profile/employee-profile-files.js.map +0 -1
  50. package/dist-client/pages/employee-profile/employee-profile-form.js.map +0 -1
  51. package/dist-client/pages/employee-profile/employee-profile-list-page.js.map +0 -1
  52. package/dist-client/pages/employee-profile/employee-profile-preview.js.map +0 -1
  53. package/dist-client/pages/employee-profile/my-employee-profile-page.js.map +0 -1
  54. package/dist-client/route.js.map +0 -1
  55. package/dist-client/tsconfig.tsbuildinfo +0 -1
  56. package/dist-client/types/approval-line.js.map +0 -1
  57. package/dist-client/types/contact.js.map +0 -1
  58. package/dist-client/types/department.js.map +0 -1
  59. package/dist-client/types/employee.js.map +0 -1
  60. package/dist-client/types/index.js.map +0 -1
  61. package/dist-client/types/org-member.js.map +0 -1
  62. package/dist-server/ai-entry/employee-profile-entry.js.map +0 -1
  63. package/dist-server/ai-entry/entry-target-shape.js.map +0 -1
  64. package/dist-server/ai-entry/organization-entry-rules.js.map +0 -1
  65. package/dist-server/ai-entry/organization-entry-targets.js.map +0 -1
  66. package/dist-server/controllers/register-employee-as-system-user.js.map +0 -1
  67. package/dist-server/index.js.map +0 -1
  68. package/dist-server/migrations/1723861013111-seed-organization-codes.js.map +0 -1
  69. package/dist-server/migrations/index.js.map +0 -1
  70. package/dist-server/role-tasks.js.map +0 -1
  71. package/dist-server/routes.js.map +0 -1
  72. package/dist-server/service/approval-line/approval-line-item.js.map +0 -1
  73. package/dist-server/service/approval-line/approval-line-mutation.js.map +0 -1
  74. package/dist-server/service/approval-line/approval-line-query.js.map +0 -1
  75. package/dist-server/service/approval-line/approval-line-type.js.map +0 -1
  76. package/dist-server/service/approval-line/approval-line.js.map +0 -1
  77. package/dist-server/service/approval-line/index.js.map +0 -1
  78. package/dist-server/service/audience/audience-member.js.map +0 -1
  79. package/dist-server/service/audience/audience.js.map +0 -1
  80. package/dist-server/service/certificate/employment-certificate-rules.js.map +0 -1
  81. package/dist-server/service/certificate/employment-certificate-templates.js.map +0 -1
  82. package/dist-server/service/certificate/employment-certificates.js.map +0 -1
  83. package/dist-server/service/department/department-history.js.map +0 -1
  84. package/dist-server/service/department/department-mutation.js.map +0 -1
  85. package/dist-server/service/department/department-parent.js.map +0 -1
  86. package/dist-server/service/department/department-query.js.map +0 -1
  87. package/dist-server/service/department/department-type.js.map +0 -1
  88. package/dist-server/service/department/department.js.map +0 -1
  89. package/dist-server/service/department/event-subscriber.js.map +0 -1
  90. package/dist-server/service/department/index.js.map +0 -1
  91. package/dist-server/service/domain-reference.js.map +0 -1
  92. package/dist-server/service/employee/employee-control-no.js.map +0 -1
  93. package/dist-server/service/employee/employee-day.js.map +0 -1
  94. package/dist-server/service/employee/employee-history.js.map +0 -1
  95. package/dist-server/service/employee/employee-mutation.js.map +0 -1
  96. package/dist-server/service/employee/employee-private.js.map +0 -1
  97. package/dist-server/service/employee/employee-query.js.map +0 -1
  98. package/dist-server/service/employee/employee-type.js.map +0 -1
  99. package/dist-server/service/employee/employee.js.map +0 -1
  100. package/dist-server/service/employee/event-subscriber.js.map +0 -1
  101. package/dist-server/service/employee/index.js.map +0 -1
  102. package/dist-server/service/employee/my-employee-refusal.js.map +0 -1
  103. package/dist-server/service/employee/my-employee.js.map +0 -1
  104. package/dist-server/service/employee/working-employees.js.map +0 -1
  105. package/dist-server/service/employee-profile/employee-profile-document.js.map +0 -1
  106. package/dist-server/service/employee-profile/employee-profile-mutation.js.map +0 -1
  107. package/dist-server/service/employee-profile/employee-profile-query.js.map +0 -1
  108. package/dist-server/service/employee-profile/employee-profile-rows.js.map +0 -1
  109. package/dist-server/service/employee-profile/employee-profile-rules.js.map +0 -1
  110. package/dist-server/service/employee-profile/employee-profile-type.js.map +0 -1
  111. package/dist-server/service/employee-profile/employee-profile.js.map +0 -1
  112. package/dist-server/service/employee-profile/index.js.map +0 -1
  113. package/dist-server/service/index.js.map +0 -1
  114. package/dist-server/tsconfig.tsbuildinfo +0 -1
  115. package/dist-server/work-doors.js.map +0 -1
  116. package/spec/unit/approval-line.spec.ts +0 -329
  117. package/spec/unit/department.spec.ts +0 -253
  118. package/spec/unit/employee.spec.ts +0 -271
  119. package/spec/unit/my-employee.spec.ts +0 -102
  120. package/tests/approval-line-brief-plan.test.ts +0 -35
  121. package/tests/approval-line-edit.test.ts +0 -78
  122. package/tests/approval-line-mark.test.ts +0 -68
  123. package/tests/approval-line-step-fields.test.ts +0 -108
  124. package/tests/assignees-editor-no-role.test.ts +0 -32
  125. package/tests/audience.test.ts +0 -85
  126. package/tests/copy-from.test.ts +0 -17
  127. package/tests/department-open-fields.test.ts +0 -72
  128. package/tests/department-parent.test.ts +0 -187
  129. package/tests/department-patch.test.ts +0 -52
  130. package/tests/department-query-shape.test.ts +0 -130
  131. package/tests/department-selector.test.ts +0 -32
  132. package/tests/domain-reference.test.ts +0 -186
  133. package/tests/employee-day.test.ts +0 -165
  134. package/tests/employee-private.test.ts +0 -37
  135. package/tests/employee-profile-db.test.ts +0 -261
  136. package/tests/employee-profile-document.test.ts +0 -282
  137. package/tests/employee-profile-entry.test.ts +0 -72
  138. package/tests/employee-profile-rules.test.ts +0 -103
  139. package/tests/entity360.test.ts +0 -36
  140. package/tests/my-picture.test.ts +0 -21
  141. package/tests/organization-entry-targets.test.ts +0 -236
  142. package/tests/refusals-in-korean.test.ts +0 -48
  143. package/tests/register-employee-role.test.ts +0 -97
@@ -1 +0,0 @@
1
- {"version":3,"file":"department-query.js","sourceRoot":"","sources":["../../../server/service/department/department-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAC9F,qCAAgC;AAChC,qEAA4D;AAC5D,iDAAuG;AACvG,yDAAgD;AAChD,6CAAyC;AACzC,uDAAkD;AAClD,mDAA+C;AAE/C;;;;GAIG;AACH,MAAM,qBAAqB,GAAG;IAC5B,WAAW,EAAE,CAAC,MAAM,EAAE,aAAa,EAAE,WAAW,CAAC;IACjD,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,CAAC;IAClH,SAAS,EAAE,CAAC,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,CAAC;CACjG,CAAA;AAGM,IAAM,eAAe,GAArB,MAAM,eAAe;IAGpB,AAAN,KAAK,CAAC,eAAe,CACM,MAAiB,EACnC,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,MAAM,YAAY,GAAG,IAAA,qCAA6B,EAAC;YACjD,MAAM;YACN,MAAM;YACN,UAAU,EAAE,MAAM,IAAA,qBAAa,EAAC,uBAAU,CAAC;YAC3C,GAAG,qBAAqB;SACzB,CAAC,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,IAAA,gBAAM,GAAE,EAAE,EAAE,CAAC,CAAA;QAE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AA;;6CAAa,uBAAU;;6CAE1C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAa,uBAAU;;8CAE3C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAa,uBAAU;;8CAE3C;0BA/HU,eAAe;IAD3B,IAAA,uBAAQ,EAAC,uBAAU,CAAC;GACR,eAAe,CAgI3B","sourcesContent":["import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'\nimport { IsNull } from 'typeorm'\nimport { Attachment } from '@things-factory/attachment-base'\nimport { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { Department } from './department'\nimport { DepartmentList } from './department-type'\nimport { Employee } from '../employee/employee'\n\n/*\n * Every seat reads departments, while `manager` and `members` ask `employee:query` (department.ts). A list is searched,\n * filtered and sorted only by the fields it shows to everybody: filtering by a closed field would tell, by whether a\n * department stays in the list, what that field holds (ADR-0139 §10).\n */\nconst DEPARTMENT_LIST_RULES = {\n searchables: ['name', 'description', 'controlNo'],\n filterables: ['id', 'name', 'description', 'controlNo', 'active', 'extension', 'parent', 'createdAt', 'updatedAt'],\n sortables: ['name', 'description', 'controlNo', 'active', 'extension', 'createdAt', 'updatedAt']\n}\n\n@Resolver(Department)\nexport class DepartmentQuery {\n @Directive('@privilege(category: \"department\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(returns => DepartmentList, { nullable: true, description: 'To fetch a Root Departments' })\n async departmentRoots(\n @Args(type => ListParam) params: ListParam,\n @Ctx() context: ResolverContext\n ): Promise<DepartmentList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(Department),\n ...DEPARTMENT_LIST_RULES\n }).andWhere({ domain: { id: domain.id }, parent: { id: IsNull() } })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @Directive('@privilege(category: \"department\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(returns => Department!, { nullable: true, description: 'To fetch a Department' })\n async department(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Department> {\n const { domain } = context.state\n\n return await getRepository(Department).findOne({\n where: { domain: { id: domain.id }, id }\n })\n }\n\n @Directive('@privilege(category: \"department\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(returns => DepartmentList, { description: 'To fetch multiple Departments' })\n async departments(\n @Args(type => ListParam) params: ListParam,\n @Ctx() context: ResolverContext\n ): Promise<DepartmentList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(Department),\n ...DEPARTMENT_LIST_RULES\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @FieldResolver(type => Employee)\n async manager(@Root() department: Department): Promise<Employee> {\n return (\n department.managerId &&\n (await getRepository(Employee).findOneBy({\n id: department.managerId\n }))\n )\n }\n\n @FieldResolver(type => [Employee], { nullable: true })\n async members(@Root() department: Department): Promise<Employee[]> {\n return await getRepository(Employee).find({\n where: { domain: { id: department.domainId }, department: { id: department.id } },\n order: { controlNo: 'ASC' }\n })\n }\n\n @FieldResolver(type => Department)\n async parent(@Root() department: Department): Promise<Department> {\n return (\n department.parentId &&\n (await getRepository(Department).findOneBy({\n id: department.parentId\n }))\n )\n }\n\n @FieldResolver(type => [Department])\n async children(\n @Root() department: Department,\n @Args(type => ListParam) params: ListParam,\n @Ctx() context: ResolverContext\n ): Promise<Department[]> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(Department),\n ...DEPARTMENT_LIST_RULES\n }).andWhere({\n parent: { id: department.id }\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return items\n }\n\n @FieldResolver(type => String)\n async picture(@Root() department: Department): Promise<string | undefined> {\n const attachment: Attachment = await getRepository(Attachment).findOne({\n where: {\n domain: { id: department.domainId },\n refType: Department.name,\n refBy: department.id\n }\n })\n\n return attachment?.fullpath\n }\n\n @FieldResolver(type => Domain)\n async domain(@Root() department: Department): Promise<Domain> {\n return await getRepository(Domain).findOneBy({ id: department.domainId })\n }\n\n @FieldResolver(type => User)\n async updater(@Root() department: Department): Promise<User> {\n return await getRepository(User).findOneBy({ id: department.updaterId })\n }\n\n @FieldResolver(type => User)\n async creator(@Root() department: Department): Promise<User> {\n return await getRepository(User).findOneBy({ id: department.creatorId })\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"department-type.js","sourceRoot":"","sources":["../../../server/service/department/department-type.ts"],"names":[],"mappings":";;;;AACA,+FAA2D;AAC3D,+CAAsF;AAEtF,iDAA+D;AAE/D,6CAAyC;AACzC,6DAAgE;AAGzD,IAAM,aAAa,GAAnB,MAAM,aAAa;CAwBzB,CAAA;AAxBY,sCAAa;AAExB;IADC,IAAA,oBAAK,GAAE;;gDACS;AAGjB;IADC,IAAA,oBAAK,GAAE;;2CACI;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kDACN;AAGpB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACV;AAGhB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACR;AAGlB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,0BAAa,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CAC7B;AAGpB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACpC,iBAAS;6CAAA;AAGlB;IADC,IAAA,oBAAK,EAAC,IAAI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K,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,uBAAU,CAAC,CAAC;;6CACT;AAGnB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;6CACN;yBALF,cAAc;IAD1B,IAAA,yBAAU,GAAE;GACA,cAAc,CAM1B","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'\n\nimport { ObjectRef, ScalarObject } from '@things-factory/shell'\n\nimport { Department } from './department'\nimport { ObjectRefForEmployee } from '../employee/employee-type'\n\n@InputType()\nexport class NewDepartment {\n @Field()\n controlNo: string\n\n @Field()\n name: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field({ nullable: true })\n active?: boolean\n\n @Field({ nullable: true })\n extension?: string\n\n @Field(type => GraphQLUpload, { nullable: true })\n picture?: FileUpload\n\n @Field(type => ObjectRef, { nullable: true })\n parent?: ObjectRef\n\n @Field(type => ObjectRefForEmployee, { nullable: true })\n manager?: ObjectRefForEmployee\n}\n\n@InputType()\nexport class DepartmentPatch {\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 description?: string\n\n @Field({ nullable: true })\n active?: boolean\n\n @Field(type => GraphQLUpload, { nullable: true })\n picture?: FileUpload\n\n @Field(type => ObjectRef, { nullable: true })\n parent?: ObjectRef\n\n @Field(type => ObjectRefForEmployee, { nullable: true })\n manager?: ObjectRefForEmployee\n\n @Field({ nullable: true })\n cuFlag?: string\n}\n\n@ObjectType()\nexport class DepartmentList {\n @Field(type => [Department])\n items: Department[]\n\n @Field(type => Int)\n total: number\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"department.js","sourceRoot":"","sources":["../../../server/service/department/department.ts"],"names":[],"mappings":";;;;AAAA,qCAYgB;A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AAM,EAAE,UAAU,CAAC,IAAI,CAAC,EAAE;QAC1F,MAAM,EAAE,IAAI;QACZ,KAAK,EAAE,sBAAsB;KAC9B,CAAC;IACD,IAAA,eAAK,EAAC,iBAAiB,EAAE,CAAC,UAAsB,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC,SAAS,CAAC,EAAE;QAC/F,MAAM,EAAE,IAAI;QACZ,KAAK,EAAE,sBAAsB;KAC9B,CAAC;IACD,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,uBAAuB,EAAE,CAAC;GACxC,UAAU,CA8FtB","sourcesContent":["import {\n CreateDateColumn,\n UpdateDateColumn,\n DeleteDateColumn,\n Entity,\n Index,\n Column,\n RelationId,\n ManyToOne,\n OneToMany,\n PrimaryGeneratedColumn,\n VersionColumn\n} from 'typeorm'\nimport { ObjectType, Field, Int, ID, registerEnumType, Directive } from 'type-graphql'\n\nimport { Domain } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { Employee } from '../employee/employee'\n\n@Entity()\n@Index('ix_department_0', (department: Department) => [department.domain, department.name], {\n unique: true,\n where: '\"deleted_at\" IS NULL'\n})\n@Index('ix_department_1', (department: Department) => [department.domain, department.controlNo], {\n unique: true,\n where: '\"deleted_at\" IS NULL'\n})\n@ObjectType({ description: 'Entity for Department' })\nexport class Department {\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((department: Department) => department.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 description?: string\n\n @ManyToOne(type => Department, department => department.children, { nullable: true })\n @Field({ nullable: true })\n parent?: Department\n\n @RelationId((department: Department) => department.parent)\n parentId?: string\n\n @OneToMany(type => Department, department => department.parent)\n @Field(type => [Department])\n children?: Department[]\n\n /*\n * Every seat reads the departments; the people in them stay the roster's (ADR-0139). These two lead to employee\n * records, so they ask what the employee list asks - refused alone, the rest of the department still comes back.\n * A field declared here takes these directives even where `DepartmentQuery` resolves it. Both are nullable: a\n * refused non-null field would null the whole list above it.\n */\n @OneToMany(type => Employee, employee => employee.department)\n @Directive('@privilege(category: \"employee\", privilege: \"query\", domainOwnerGranted: true)')\n @Field(type => [Employee], { nullable: true })\n members?: Employee[]\n\n @ManyToOne(type => Employee, manager => manager.manages, { nullable: true })\n @Directive('@privilege(category: \"employee\", privilege: \"query\", domainOwnerGranted: true)')\n @Field(type => Employee, { nullable: true })\n manager?: Employee\n\n @RelationId((department: Department) => department.manager)\n managerId?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n active?: boolean\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n extension?: string\n\n @Field(type => String, { nullable: true })\n picture?: 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((department: Department) => department.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((department: Department) => department.updater)\n updaterId?: string\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"event-subscriber.js","sourceRoot":"","sources":["../../../server/service/department/event-subscriber.ts"],"names":[],"mappings":";;;;AAAA,qCAAyC;AAEzC,8DAAkE;AAElE,6CAAyC;AACzC,6DAAwD;AAGjD,IAAM,iCAAiC,GAAvC,MAAM,iCAAkC,SAAQ,yCAAsD;IAC3G,IAAW,MAAM;QACf,OAAO,uBAAU,CAAA;IACnB,CAAC;IAED,IAAW,aAAa;QACtB,OAAO,sCAAiB,CAAA;IAC1B,CAAC;CACF,CAAA;AARY,8EAAiC;4CAAjC,iCAAiC;IAD7C,IAAA,yBAAe,GAAE;GACL,iCAAiC,CAQ7C","sourcesContent":["import { EventSubscriber } from 'typeorm'\n\nimport { HistoryEntitySubscriber } from '@operato/typeorm-history'\n\nimport { Department } from './department'\nimport { DepartmentHistory } from './department-history'\n\n@EventSubscriber()\nexport class DepartmentHistoryEntitySubscriber extends HistoryEntitySubscriber<Department, DepartmentHistory> {\n public get entity() {\n return Department\n }\n\n public get historyEntity() {\n return DepartmentHistory\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/department/index.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AACzC,6DAAwD;AACxD,yDAAoD;AACpD,+DAA0D;AAC1D,yDAAsE;AAEzD,QAAA,QAAQ,GAAG,CAAC,uBAAU,EAAE,sCAAiB,CAAC,CAAA;AAC1C,QAAA,SAAS,GAAG,CAAC,kCAAe,EAAE,wCAAkB,CAAC,CAAA;AACjD,QAAA,WAAW,GAAG,CAAC,oDAAiC,CAAC,CAAA","sourcesContent":["import { Department } from './department'\nimport { DepartmentHistory } from './department-history'\nimport { DepartmentQuery } from './department-query'\nimport { DepartmentMutation } from './department-mutation'\nimport { DepartmentHistoryEntitySubscriber } from './event-subscriber'\n\nexport const entities = [Department, DepartmentHistory]\nexport const resolvers = [DepartmentQuery, DepartmentMutation]\nexport const subscribers = [DepartmentHistoryEntitySubscriber]\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"domain-reference.js","sourceRoot":"","sources":["../../server/service/domain-reference.ts"],"names":[],"mappings":";;AAgBA,8CAeC;AAMD,oCAmBC;AAtDD,iDAAsE;AACtE,yDAAgD;AAEhD;;;;;;;;;;GAUG;AACI,KAAK,UAAU,iBAAiB,CACrC,UAAyB,EACzB,GAAuC,EACvC,MAAc,EACd,IAA6C;IAE7C,IAAI,GAAG,KAAK,SAAS;QAAE,OAAO,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iteral, Repository } from 'typeorm'\n\nimport { Domain, getRepository, Refusal } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\n\n/*\n * A record a patch points at, looked up inside the caller's domain.\n *\n * The lookups this replaces asked by id alone, so a mutation run in one domain could make its\n * department's manager, or its employee's supervisor, a row of another domain: the id was all it\n * took. The answer here is the same three as `checkedParent`:\n *\n * key absent, or undefined undefined — leave the reference as it is\n * null, or no id null — clear it\n * an id the row — refused when the domain has no such row\n */\nexport async function referenceInDomain<T extends ObjectLiteral>(\n repository: Repository<T>,\n ref: { id?: string } | null | undefined,\n domain: Domain,\n what: 'manager' | 'supervisor' | 'department'\n): Promise<T | null | undefined> {\n if (ref === undefined) return undefined\n if (ref === null || !ref.id) return null\n\n const found = await repository.findOne({ where: { domain: { id: domain.id }, id: ref.id } as any })\n if (!found) {\n throw new Refusal(`${what}-not-in-domain`, {}, `${what} not found in this domain: ${ref.id}`)\n }\n\n return found\n}\n\n/*\n * A user is not owned by a domain the way an employee is — it belongs to several, through\n * `users_domains`. The one an employee is connected to has to be among this domain's users.\n */\nexport async function userInDomain(\n ref: { id?: string } | null | undefined,\n domain: Domain,\n tx?: EntityManager\n): Promise<User | null | undefined> {\n if (ref === undefined) return undefined\n if (ref === null || !ref.id) return null\n\n const found = await getRepository(User, tx)\n .createQueryBuilder('user')\n .innerJoin('user.domains', 'domain', 'domain.id = :domainId', { domainId: domain.id })\n .where('user.id = :id', { id: ref.id })\n .getOne()\n\n if (!found) {\n throw new Refusal('user-not-in-domain', {}, `user not found in this domain: ${ref.id}`)\n }\n\n return found\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"employee-control-no.js","sourceRoot":"","sources":["../../../server/service/employee/employee-control-no.ts"],"names":[],"mappings":";;AAWA,sDAmBC;AA5BD,iDAA+C;AAE/C,yCAAqC;AAErC;;;;GAIG;AACI,KAAK,UAAU,qBAAqB,CACzC,EAAiB,EACjB,MAAsB,EACtB,IAAkD;IAElD,MAAM,QAAQ,GAA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AAC","sourcesContent":["import { EntityManager } from 'typeorm'\n\nimport { Refusal } from '@things-factory/shell'\n\nimport { Employee } from './employee'\n\n/**\n * A 관리 번호 names one live employee in the domain. The unique index carries `deletedAt`, which is NULL on every live\n * row, and NULLs are never equal - so the index does not hold two live employees apart; this does, on the domain as the\n * save leaves it. A row without an `id` is new; one with an `id` that leaves `controlNo` out keeps its own.\n */\nexport async function refuseTakenControlNos(\n tx: EntityManager,\n domain: { id: string },\n rows: { id?: string; controlNo?: string | null }[]\n): Promise<void> {\n const changing = rows.filter(row => row.controlNo !== undefined)\n for (const { controlNo } of changing)\n if (controlNo === null || String(controlNo).trim() === '')\n throw new Refusal('employee-control-no-required', {}, 'controlNo: an employee has one')\n\n const changed = new Set(changing.map(row => row.id).filter(Boolean))\n const kept = (await tx.getRepository(Employee).find({ where: { domain: { id: domain.id } }, select: ['id', 'controlNo'] }))\n .filter(one => !changed.has(one.id))\n .map(one => one.controlNo)\n const after = [...kept]\n for (const { controlNo } of changing) {\n if (after.includes(controlNo)) throw new Refusal('employee-control-no-taken', { value: controlNo }, `controlNo: ${controlNo} is already another employee's`)\n after.push(controlNo)\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"employee-day.js","sourceRoot":"","sources":["../../../server/service/employee/employee-day.ts"],"names":[],"mappings":";;AAWA,sBAaC;AAED,4BAMC;AAhCD;;;;GAIG;AACH,iDAA+C;AAE/C,MAAM,UAAU,GAAG,CAAC,SAAS,EAAE,WAAW,CAAU,CAAA;AACpD,gFAAgF;AAChF,MAAM,YAAY,GAA2B,EAAE,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,oBAAoB,EAAE,CAAA;AAE7G,SAAgB,KAAK,CAAC,KAAa,EAAE,KAAc;IACjD,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,SAAS,CAAA;IACzC,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,EAAE;QAAE,OAAO,IAAI,CAAA;IAE/C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,qBAAqB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACnE,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;QACvD,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,CAAA;QACrD,IAAI,IAAI,CAAC,cAAc,EAAE,KAAK,IAAI,IAAI,IAAI,CAAC,WAAW,EAAE,KAAK,KAAK,GAAG,CAAC,IAAI,IAAI,CAAC,UAAU,EAAE,KAAK,GAAG,EAAE,CAAC;YACpG,OAAO,KAAK,CAAA;QACd,CAAC;IACH,CAAC;IAED,MAAM,IAAI,eAAO,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,aAAa,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,GAAG,KAAK,iDAAiD,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;AACrK,CAAC;AAED,SAAgB,QAAQ,CAAuD,KAAQ;IACrF,MAAM,MAAM,GAAG,EAAE,GAAG,KAAK,EAAE,CAAA;IAC3B,KAAK,MAAM,KAAK,IAAI,UAAU,EAAE,CAAC;QAC/B,IAAI,KAAK,IAAI,MAAM;YAAG,MAAc,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAA;IAC3E,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC","sourcesContent":["/*\n * hiredOn and retiredOn are calendar days. The GraphQL field is a String, so it takes any text; this is where a\n * value that is not a day is turned away instead of being stored — an old export's '2025-12-31T00:00:00.000Z',\n * a spreadsheet's serial number. An empty cell (the grid's cleared date input sends '') means no day.\n */\nimport { Refusal } from '@things-factory/shell'\n\nconst DAY_FIELDS = ['hiredOn', 'retiredOn'] as const\n/* The refusal of each field - the reader sees the field's name, not hiredOn. */\nconst DAY_REFUSALS: Record<string, string> = { hiredOn: 'hired-on-invalid', retiredOn: 'retired-on-invalid' }\n\nexport function toDay(field: string, value: unknown): string | null | undefined {\n if (value === undefined) return undefined\n if (value === null || value === '') return null\n\n if (typeof value === 'string' && /^\\d{4}-\\d{2}-\\d{2}$/.test(value)) {\n const [year, month, day] = value.split('-').map(Number)\n const date = new Date(Date.UTC(year, month - 1, day))\n if (date.getUTCFullYear() === year && date.getUTCMonth() === month - 1 && date.getUTCDate() === day) {\n return value\n }\n }\n\n throw new Refusal(DAY_REFUSALS[field] ?? 'day-invalid', { value: String(value) }, `${field} must be a calendar day in YYYY-MM-DD format: ${JSON.stringify(value)}`)\n}\n\nexport function withDays<T extends { hiredOn?: unknown; retiredOn?: unknown }>(patch: T): T {\n const result = { ...patch }\n for (const field of DAY_FIELDS) {\n if (field in result) (result as any)[field] = toDay(field, result[field])\n }\n return result\n}\n"]}
@@ -1 +0,0 @@
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;AAGjB;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CA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C,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: false)')\n @Field({ nullable: true })\n bankAccount?: string\n\n @Column({ nullable: true })\n @Directive('@privilege(category: \"employee-private\", privilege: \"query\", domainOwnerGranted: false)')\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 +0,0 @@
1
- {"version":3,"file":"employee-mutation.js","sourceRoot":"","sources":["../../../server/service/employee/employee-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAqF;AACrF,qCAA4B;AAE5B,iDAA6E;AAE7E,qEAA0F;AAC1F,qDAAiD;AAEjD,yCAAqC;AACrC,mDAA4D;AAC5D,yDAAqD;AACrD,iDAAyC;AACzC,+DAA6D;AAC7D,yDAAuD;AACvD,0DAAqE;AAErE,yGAI2D;AAIpD,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;QACrC,MAAM,IAAA,2CAAqB,EAAC,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,QAAQ,CAAC,SAAS,IAAI,IAAI,EAAE,CAAC,CAAC,CAAA;QAEpF,MAAM,UAAU,GAAG,MAAM,IAAA,oCAAiB,E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,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;2BAnZU,gBAAgB;IAF5B,IAAA,uBAAQ,EAAC,mBAAQ,CAAC;IAClB,IAAA,4BAAa,EAAC,qBAAa,CAAC;GAChB,gBAAgB,CAoZ5B","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive, UseMiddleware } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { getRepository, Refusal, SpeakRefusals } 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 { refuseTakenControlNos } from './employee-control-no'\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)\n@UseMiddleware(SpeakRefusals)\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 await refuseTakenControlNos(tx, domain, [{ controlNo: employee.controlNo ?? null }])\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: false)')\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 Refusal('employee-not-found', {}, `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 await refuseTakenControlNos(tx, domain, [{ id, controlNo: patch.controlNo }])\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 await refuseTakenControlNos(tx, domain, [\n ..._createRecords.map(record => ({ controlNo: record.controlNo ?? null })),\n ..._updateRecords.map(record => ({ id: record.id, controlNo: record.controlNo }))\n ])\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 Refusal('employee-not-found', {}, `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 await refuseTakenControlNos(tx, domain, employees.map(employee => ({ id: employee.id, controlNo: employee.id ? employee.controlNo : employee.controlNo ?? null })))\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 +0,0 @@
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"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"employee-query.js","sourceRoot":"","sources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AI,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;wBA5LU,aAAa;IADzB,IAAA,uBAAQ,EAAC,mBAAQ,CAAC;GACN,aAAa,CA6LzB","sourcesContent":["import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'\nimport { GraphQLEmailAddress } from 'graphql-scalars'\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'\nimport { myEmployees as myEmployeesOf } from './my-employee.js'\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\n@Resolver(Employee)\nexport class EmployeeQuery {\n /**\n * 부른 사람 자신의 사원 기록 — **권한을 붙이지 않는다.**\n *\n * ── 왜 필요한가 ──────────────────────────────────────────────────────────\n * 「내 것」 축의 읽기와 쓰기는 이미 권한 없이 있다(`myApprovalLines` · `createMyApprovalLine` ·\n * `updateMyApprovalLine`). 그 자리들이 모두 **사원 기록에 의존하는데, 그것이 있는지 물을 방법이\n * 없었다.**\n *\n * 그래서 사원 기록이 없는 사람에게도 「내 결재선」 화면이 입력을 받았고, 저장을 누른 뒤에야\n * 실패했다. 화면이 알아야 하는 것은 「지금 0건이다」가 아니라 **「너는 이 화면을 쓸 수 없다」**다.\n * 그건 목록이 아니라 자격에 대한 물음이므로 답하는 자리가 따로 있어야 한다.\n *\n * ── 왜 권한이 없나 ──────────────────────────────────────────────────────\n * 「나는 누구인가」는 권한으로 가릴 사실이 아니다. 자기 기록만 답하므로 새는 것이 없다.\n * `employees` 는 `employee:query` 를 요구하는데, 그것으로는 **정작 답이 필요한 일반 사원이 물을 수\n * 없다.**\n *\n * ── 왜 복수인가 ────────────────────────────────────────────────────────\n * `Employee` 에 `(domain, user)` 유일 제약이 없다 — 유일한 것은\n * `(domain, controlNo, deletedAt)` 뿐이다(`employee.ts:36`). 그래서 한 사용자가 한 도메인에서 사원\n * 기록을 둘 이상 가질 수 있고, `myApprovalLines` 도 그것을 전제로 `In(...)` 을 쓴다.\n *\n * 단수로 두면 **없는 제약을 지어내는 것**이 된다. 비어 있으면 빈 배열이다 — 오류가 아니다.\n */\n @Query(returns => [Employee], {\n description: \"Fetches the caller's own employee records in this domain. Empty when the caller is not an employee.\"\n })\n async myEmployees(@Ctx() context: ResolverContext): Promise<Employee[]> {\n /*\n * 조회를 여기서 다시 쓰지 않는다. 「이 사용자의 사원 기록」을 판정하는 자리는 `my-employee.ts`\n * 하나다 — 그 자리가 없어서 같은 물음을 네 곳이 각자 다르게 다루던 것이 이 결함의 원인이었다.\n */\n return await myEmployeesOf(context)\n }\n\n @Directive('@privilege(category: \"employee\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(returns => Employee!, {\n nullable: true,\n description:\n 'Fetches a specific employee by their unique ID. Returns the employee object if found, or null if not found.'\n })\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 @Directive('@privilege(category: \"employee\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(returns => EmployeeList, {\n description:\n 'Fetches a list of employees based on provided query parameters. Supports searching by name, control number, alias, position, responsibility and department name.'\n })\n async employees(@Args(type => ListParam) 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 /*\n * A LIKE filter on a field outside this list is dropped with a warning, so a part of a position, a responsibility or a\n * department's name is matched only when listed here (2026-10-24: 「프로 직책인 사람」 read every employee).\n */\n searchables: ['name', 'controlNo', 'alias', 'active', 'userId', 'jobPosition', 'jobResponsibility', 'departmentName'],\n /* By the department's name - a conversation knows a team by what it is called, never by its id (ai-assistant people list). */\n filtersMap: { departmentName: { columnName: 'name', relationColumn: 'department' } }\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @FieldResolver(type => String, { nullable: true })\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, { nullable: true })\n async phone(@Root() employee: Employee, @Ctx() context: ResolverContext): Promise<string> {\n if (!employee.contactId) {\n return\n }\n\n return await getContactItem(employee.contactId, ContactField.Phone, 'work', context)\n }\n\n @FieldResolver(type => String, { nullable: true })\n async address(@Root() employee: Employee, @Ctx() context: ResolverContext): Promise<string | undefined> {\n if (!employee.contactId) {\n return\n }\n\n return await getContactItem(employee.contactId, ContactField.Address, 'work', context)\n }\n\n @FieldResolver(type => GraphQLEmailAddress, { nullable: true })\n async email(@Root() employee: Employee, @Ctx() context: ResolverContext): Promise<string | undefined> {\n if (!employee.contactId) {\n return\n }\n\n return 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 let 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 +0,0 @@
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,CAAC;;yDACN;AAGpB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+DACA;AAG1B;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,mCAAmC,EAAE,CAAC;;qDAC5D;AAGhB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;oDACV;+BA1BL,oBAAoB;IADhC,IAAA,wBAAS,GAAE;GACC,oB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,aAAa,CA+DzB;AAGM,IAAM,YAAY,GAAlB,MAAM,YAAY;CAMxB,CAAA;AANY,oCAAY;AAEvB;IADC,IAAA,oBAAK,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, description: 'The hire day in YYYY-MM-DD format' })\n hiredOn?: string\n\n @Field({ nullable: true })\n active?: boolean\n}\n\n@InputType()\nexport class ObjectRefForContact extends ObjectRef {\n @Field(type => GraphQLEmailAddress, { nullable: true })\n email?: string\n\n @Field({ nullable: true })\n phone?: string\n\n @Field({ nullable: true })\n address?: string\n}\n\n@InputType()\nexport class ObjectRefForDepartment extends ObjectRef {\n @Field({ nullable: true })\n controlNo?: string\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, description: 'The hire day in YYYY-MM-DD format' })\n hiredOn?: string\n\n @Field({ nullable: true, description: 'The retire day in YYYY-MM-DD format' })\n retiredOn?: string\n\n @Field(type => GraphQLUpload, { nullable: true })\n photo?: FileUpload\n\n @Field({ nullable: true })\n emergencyContact?: string\n\n @Field({ nullable: true })\n emergencyContactPhone?: string\n\n @Field({ nullable: true })\n bankAccount?: string\n\n @Field({ nullable: true })\n bankName?: string\n\n @Field({ nullable: true })\n note?: string\n\n @Field(type => ObjectRefForEmployee, { nullable: true })\n supervisor?: ObjectRefForEmployee\n\n @Field(type => ObjectRefForDepartment, { nullable: true })\n department?: ObjectRefForDepartment\n\n @Field(type => ObjectRefForContact, { nullable: true })\n contact?: ObjectRefForContact\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, description: 'The hire day in YYYY-MM-DD format' })\n hiredOn?: string\n\n @Field({ nullable: true, description: 'The retire day in YYYY-MM-DD format' })\n retiredOn?: string\n\n @Field(type => GraphQLUpload, { nullable: true })\n photo?: FileUpload\n\n @Field({ nullable: true })\n emergencyContact?: string\n\n @Field({ nullable: true })\n emergencyContactPhone?: string\n\n @Field({ nullable: true })\n bankAccount?: string\n\n @Field({ nullable: true })\n bankName?: string\n\n @Field({ nullable: true })\n note?: string\n\n @Field(type => ObjectRefForEmployee, { nullable: true })\n supervisor?: ObjectRefForEmployee\n\n @Field(type => ObjectRefForDepartment, { nullable: true })\n department?: ObjectRefForDepartment\n\n @Field(type => ObjectRefForContact, { nullable: true })\n contact?: ObjectRefForContact\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"]}
@@ -1 +0,0 @@
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,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;IAsJtB,CAAC;CAAA,CAAA;AA7JY,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,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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: false)')\n @Field({ nullable: true })\n bankAccount?: string\n\n @Column({ nullable: true })\n @Directive('@privilege(category: \"employee-private\", privilege: \"query\", domainOwnerGranted: false)')\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 +0,0 @@
1
- {"version":3,"file":"event-subscriber.js","sourceRoot":"","sources":["../../../server/service/employee/event-subscriber.ts"],"names":[],"mappings":";;;;AAAA,qCAAyC;AAEzC,8DAAkE;AAElE,yCAAqC;AACrC,yDAAoD;AAG7C,IAAM,+BAA+B,GAArC,MAAM,+BAAgC,SAAQ,yCAAkD;IACrG,IAAW,MAAM;QACf,OAAO,mBAAQ,CAAA;IACjB,CAAC;IAED,IAAW,aAAa;QACtB,OAAO,kCAAe,CAAA;IACxB,CAAC;CACF,CAAA;AARY,0EAA+B;0CAA/B,+BAA+B;IAD3C,IAAA,yBAAe,GAAE;GACL,+BAA+B,CAQ3C","sourcesContent":["import { EventSubscriber } from 'typeorm'\n\nimport { HistoryEntitySubscriber } from '@operato/typeorm-history'\n\nimport { Employee } from './employee'\nimport { EmployeeHistory } from './employee-history'\n\n@EventSubscriber()\nexport class EmployeeHistoryEntitySubscriber extends HistoryEntitySubscriber<Employee, EmployeeHistory> {\n public get entity() {\n return Employee\n }\n\n public get historyEntity() {\n return EmployeeHistory\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/employee/index.ts"],"names":[],"mappings":";;;;AAAA,yCAAqC;AACrC,yDAAoD;AACpD,qDAAgD;AAChD,2DAAsD;AACtD,yDAAoE;AAEvD,QAAA,QAAQ,GAAG,CAAC,mBAAQ,EAAE,kCAAe,CAAC,CAAA;AACtC,QAAA,SAAS,GAAG,CAAC,8BAAa,EAAE,oCAAgB,CAAC,CAAA;AAC7C,QAAA,WAAW,GAAG,CAAC,kDAA+B,CAAC,CAAA;AAE5D,gDAAgD;AAChD,2DAAgC","sourcesContent":["import { Employee } from './employee'\nimport { EmployeeHistory } from './employee-history'\nimport { EmployeeQuery } from './employee-query'\nimport { EmployeeMutation } from './employee-mutation'\nimport { EmployeeHistoryEntitySubscriber } from './event-subscriber'\n\nexport const entities = [Employee, EmployeeHistory]\nexport const resolvers = [EmployeeQuery, EmployeeMutation]\nexport const subscribers = [EmployeeHistoryEntitySubscriber]\n\n/* 「이 사용자의 사원 기록」 판정 — 소비처가 다시 정하지 않게 밖으로 낸다. */\nexport * from './my-employee.js'\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"my-employee-refusal.js","sourceRoot":"","sources":["../../../server/service/employee/my-employee-refusal.ts"],"names":[],"mappings":";;AA6DA,kDASC;AAOD,gEASC;AAQD,wCAKC;AAnGD,qCAAsC;AAmCtC;;;;;GAKG;AACH,SAAS,SAAS,CAAC,OAAY,EAAE,GAAW,EAAE,QAAgB;IAC5D,MAAM,CAAC,GAAG,OAAO,OAAO,EAAE,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IAC7D,IAAI,CAAC,CAAC;QAAE,OAAO,QAAQ,CAAA;IAEvB,IAAI,UAAkB,CAAA;IACtB,IAAI,CAAC;QACH,UAAU,GAAG,CAAC,CAAC,GAAG,CAAC,CAAA;IACrB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,QAAQ,CAAA;IACjB,CAAC;IACD,wDAAwD;IACxD,OAAO,CAAC,UAAU,IAAI,UAAU,KAAK,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAA;AAClE,CAAC;AAED;;;;;GAKG;AACH,SAAgB,mBAAmB,CAAC,OAAY;IAC9C,OAAO,IAAI,sBAAY,CACrB,SAAS,CACP,OAAO,EACP,4BAA4B,EAC5B,4GAA4G,CAC7G,EACD,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,aAA2C,EAAE,EAAE,CAC7F,CAAA;AACH,CAAC;AAED;;;;GAIG;AACH,SAAgB,0BAA0B,CAAC,OAAY,EAAE,KAAa;IACpE,OAAO,IAAI,sBAAY,CACrB,SAAS,CACP,OAAO,EACP,mCAAmC,EACnC,6BAA6B,KAAK,iGAAiG,CACpI,EACD,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,oBAAkD,EAAE,KAAK,EAAE,EAAE,CAC3G,CAAA;AACH,CAAC;AAGD;;;;GAIG;AACH,SAAgB,cAAc,CAAI,SAAuB,EAAE,OAAY;IACrE,IAAI,CAAC,SAAS,CAAC,MAAM;QAAE,MAAM,mBAAmB,CAAC,OAAO,CAAC,CAAA;IACzD,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC;QAAE,MAAM,0BAA0B,CAAC,OAAO,EAAE,SAAS,CAAC,MAAM,CAAC,CAAA;IAErF,OAAO,SAAS,CAAC,CAAC,CAAE,CAAA;AACtB,CAAC","sourcesContent":["import { GraphQLError } from 'graphql'\n\n/*\n * **「이 사용자의 사원 기록」 판정** — 순수한 부분. 저장소를 지나지 않는다.\n *\n * 배선(§`my-employee.ts`)에서 갈라 둔 이유는 시험이다. `Employee` 엔티티를 가져오면\n * `@things-factory/contact` 가 딸려 오고 그것이 import 시점에 설정을 읽는다 — 시험이 서지 않는다.\n * 그러면 **이 거절 판정을 아무 시험도 걷지 않고**, 사용자 얼굴까지 가는 문장이 아무도 안 본 채로\n * 나간다. 실제로 그 상태였다(영어 개발자 문장 하나가 네 자리에 복사돼 있었다).\n *\n * ── 같은 사실을 네 가지로 다루고 있었다 (2026-09-03, UX 레인이 겪음) ──────────\n * createMyApprovalLine 외 3곳 findOneBy + 없으면 영어 한 문장을 던진다\n * updateMyApprovalLine 검사가 없다 → `employee.id` 에서 null 참조로 터진다\n * myApprovalLines findBy + In([]) 를 그냥 쓴다\n * approvalLineReferences findBy + length > 0 으로 갈라 쓴다\n *\n * 넷이 각자 옳고 그름이 있는 것이 아니라, **판정할 자리가 없어서** 부르는 사람마다 다시 정한 것이다.\n * 그래서 검사가 있는 줄 알고 고친 사람이 터지는 자리를 남겼고, 사용자는 입력을 다 하고 나서\n * 저장할 때 실패했다.\n *\n * ── 복수가 맞다 ──────────────────────────────────────────────────────────────\n * 표의 유일 제약은 `(domain, controlNo, deletedAt)` 이다 — **`(domain, user)` 에는 없다.** 한 사용자가\n * 한 도메인에서 사원 기록을 둘 이상 가지는 것을 아무것도 막지 않는다.\n *\n * 그런데 뮤테이션 넷이 `findOneBy` 로 읽었다. 여럿이면 **드라이버가 먼저 준 하나**를 집고, 그 사람의\n * 개인 결재선이 엉뚱한 사원 기록에 붙는다. 오류는 안 난다.\n *\n * 그래서 하나여야 하는 부름은 **여럿일 때 거절한다** — 「너는 어느 사원으로 행동하는가」는 우리가\n * 짐작할 수 없는 물음이다. 지금 데이터에는 중복이 없으므로(사용자 12명, 중복 0) 도는 것이 멈추지\n * 않고, 생기는 날 조용히 틀리는 대신 말한다.\n */\n\n/** 이 오류를 화면이 문장 파싱 없이 가를 수 있게 — `privilegeRejection` 과 같은 규약. */\nexport type EmployeeRequirement = 'no-employee' | 'ambiguous-employee'\n\n/**\n * 번역이 없으면 영어 문장을 그대로 쓴다(§`privilege-rejection.ts` 와 같은 이유).\n *\n * 키는 이 패키지의 관례를 따른다 — `error.contact-information-required` 처럼 kebab-case 다.\n * `auth-base` 는 띄어쓰기를 쓰는데, 한 패키지 안에서 두 관례를 섞지 않는다.\n */\nfunction localized(context: any, key: string, fallback: string): string {\n const t = typeof context?.t === 'function' ? context.t : null\n if (!t) return fallback\n\n let translated: string\n try {\n translated = t(key)\n } catch {\n return fallback\n }\n /* i18next 는 키를 못 찾으면 키를 그대로 돌려준다 — 그걸 사용자에게 보이지 않는다. */\n return !translated || translated === key ? fallback : translated\n}\n\n/**\n * 사원 기록이 없어서 못 한다 — **읽는 사람이 무엇을 해야 할지 알 수 있게.**\n *\n * 예전 문장은 `There is no employee object associated with the user.` 였다. 개발자의 말이고, 「누가\n * 붙여 줄 수 있는가」가 없다. 이 오류는 프레임워크 apollo 링크를 타고 **사용자 얼굴까지** 간다.\n */\nexport function noEmployeeRejection(context: any): GraphQLError {\n return new GraphQLError(\n localized(\n context,\n 'error.no-employee-for-user',\n 'this account is not linked to an employee record — a domain administrator can link it in the employee list'\n ),\n { extensions: { code: 'FORBIDDEN', requires: 'no-employee' satisfies EmployeeRequirement } }\n )\n}\n\n/**\n * 사원 기록이 여럿이어서 **어느 것으로 행동하는지 모른다.**\n *\n * 짐작해서 하나를 집지 않는다 — 그러면 개인 결재선이 엉뚱한 사원 기록에 붙고 아무 오류도 안 난다.\n */\nexport function ambiguousEmployeeRejection(context: any, count: number): GraphQLError {\n return new GraphQLError(\n localized(\n context,\n 'error.multiple-employees-for-user',\n `this account is linked to ${count} employee records, so it is unclear which one is acting — a domain administrator must leave one`\n ),\n { extensions: { code: 'FORBIDDEN', requires: 'ambiguous-employee' satisfies EmployeeRequirement, count } }\n )\n}\n\n\n/**\n * 여럿 중 **하나**를 고른다 — 고를 수 없으면 거절한다.\n *\n * 저장소를 읽는 쪽과 갈라 둔다. 「몇 개면 무엇을 하는가」가 판정이고, 「몇 개인지 읽는 것」이 배선이다.\n */\nexport function theOneEmployee<T>(employees: readonly T[], context: any): T {\n if (!employees.length) throw noEmployeeRejection(context)\n if (employees.length > 1) throw ambiguousEmployeeRejection(context, employees.length)\n\n return employees[0]!\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"my-employee.js","sourceRoot":"","sources":["../../../server/service/employee/my-employee.ts"],"names":[],"mappings":";;AAeA,kCAKC;AAQD,8CAEC;AAQD,sCAEC;;AAxCD;;GAEG;AACH,iDAAqD;AAErD,+CAAwC;AACxC,qEAAyD;AAEzD,mEAAwC;AAExC;;;;GAIG;AACI,KAAK,UAAU,WAAW,CAAC,OAAY;IAC5C,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,EAAE,KAAK,IAAI,EAAE,CAAA;IACjD,IAAI,CAAC,MAAM,EAAE,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE;QAAE,OAAO,EAAE,CAAA;IAEvC,OAAO,MAAM,IAAA,qBAAa,EAAC,sBAAQ,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC,CAAA;AACvG,CAAC;AAED;;;;;GAKG;AACI,KAAK,UAAU,iBAAiB,CAAC,OAAY;IAClD,OAAO,IAAA,uCAAc,EAAC,MAAM,WAAW,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAA;AAC5D,CAAC;AAED;;;;;GAKG;AACI,KAAK,UAAU,aAAa,CAAC,OAAY;IAC9C,OAAO,CAAC,MAAM,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;AAClE,CAAC","sourcesContent":["/*\n * **「이 사용자의 사원 기록」을 읽는다** — 배선. 판정은 `my-employee-refusal.ts` 가 한다.\n */\nimport { getRepository } from '@things-factory/shell'\n\nimport { Employee } from './employee.js'\nimport { theOneEmployee } from './my-employee-refusal.js'\n\nexport * from './my-employee-refusal.js'\n\n/**\n * 이 사용자의 사원 기록들 — **없으면 빈 배열이고, 그것은 오류가 아니다.**\n *\n * 목록이 부른다. 「없다」는 그 목록의 참인 답이므로 여기서 던지지 않는다.\n */\nexport async function myEmployees(context: any): Promise<Employee[]> {\n const { domain, user, tx } = context?.state ?? {}\n if (!domain?.id || !user?.id) return []\n\n return await getRepository(Employee, tx).findBy({ domain: { id: domain.id }, user: { id: user.id } })\n}\n\n/**\n * 이 사용자의 사원 **하나** — 없거나 여럿이면 거절한다.\n *\n * 「내 것」을 만들고 고치는 뮤테이션이 부른다. 그 자리들은 사원 하나를 소유자로 적어야 하므로,\n * 답할 수 없는 상태에서 진행하면 소유자가 틀린 행이 남는다.\n */\nexport async function requireMyEmployee(context: any): Promise<Employee> {\n return theOneEmployee(await myEmployees(context), context)\n}\n\n/**\n * 목록 조건에 쓸 사원 id 들 — **빈 배열을 `In` 에 넣지 않게.**\n *\n * `In([])` 이 드라이버마다 무엇을 내보내는지에 기대지 않는다. 부르는 쪽이 「비었나」를 보고 갈라\n * 쓰도록 배열을 그대로 준다.\n */\nexport async function myEmployeeIds(context: any): Promise<string[]> {\n return (await myEmployees(context)).map(employee => employee.id)\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"working-employees.js","sourceRoot":"","sources":["../../../server/service/employee/working-employees.ts"],"names":[],"mappings":";;;AAiBA,wDAKC;AAtBD;;;;;;GAMG;AACH,qCAAoD;AAEpD,iDAA0E;AAE1E,6FAAgF;AAGvE,iGAHA,4CAAgB,OAGA;AAFzB,+CAAwC;AAIxC,sFAAsF;AAC/E,KAAK,UAAU,sBAAsB,CAAC,MAAuB,EAAE,EAAkB,EAAE,MAAY,IAAI,IAAI,EAAE;IAC9G,IAAI,CAAC,MAAM,EAAE,EAAE;QAAE,OAAO,EAAE,CAAA;IAC1B,MAAM,KAAK,GAAG,IAAA,mBAAW,EAAE,MAAc,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAA;IACxD,MAAM,OAAO,GAAG,MAAM,IAAA,qBAAa,EAAC,sBAAQ,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,IAAA,aAAG,EAAC,IAAA,gBAAM,GAAE,CAAC,EAAE,EAAS,EAAE,SAAS,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;IACzJ,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,IAAI,IAAA,4CAAgB,EAAC,GAAU,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;AAC1H,CAAC","sourcesContent":["/*\n * Who works here today - the accounts tied to an employee record still working in the domain (not marked inactive, no\n * retire day that has come). A partner, an operator's account or a system account has no such record and is not one.\n *\n * The rule is `isActiveEmployee` (employee-profile-rules.ts); this reads the records it is asked of. Those who address\n * \"the employees\" - a vote on a proposal (ADR-0197) - narrow their people to these.\n */\nimport { EntityManager, IsNull, Not } from 'typeorm'\n\nimport { calendarDay, Domain, getRepository } from '@things-factory/shell'\n\nimport { isActiveEmployee } from '../employee-profile/employee-profile-rules.js'\nimport { Employee } from './employee.js'\n\nexport { isActiveEmployee }\n\n/** The accounts of the domain's employees working today, in the domain's calendar. */\nexport async function workingEmployeeUserIds(domain: Partial<Domain>, tx?: EntityManager, now: Date = new Date()): Promise<string[]> {\n if (!domain?.id) return []\n const today = calendarDay((domain as any).timezone, now)\n const records = await getRepository(Employee, tx).find({ where: { domain: { id: domain.id }, user: { id: Not(IsNull()) } } as any, relations: ['user'] })\n return [...new Set(records.filter(one => one.user?.id && isActiveEmployee(one as any, today)).map(one => one.user!.id))]\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"employee-profile-document.js","sourceRoot":"","sources":["../../../server/service/employee-profile/employee-profile-document.ts"],"names":[],"mappings":";;;AAoIA,wBAEC;AAGD,4BAGC;AAWD,oCAYC;AAED,wCAGC;AAGD,8BAGC;AAkBD,gDA6EC;AAGD,0CAIC;AAGD,oCAsCC;AAMD,oCAYC;AAiDD,4BAYC;AAGD,gCA4BC;AAGD,0CASC;AAiBD,gCAsCC;AA0CD,gDAEC;AAGD,kCAMC;AAGD,8CAOC;AAGD,0CAGC;AAGD,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,CAAC,CAAC,SAAS,CAAC;QACrB,QAAQ,EAAE,CAAC,CAAC,UAAU,CAAC;QACvB,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC;QACnB,OAAO,EAAE,CAAC,CAAC,SAAS,CAAC;QACrB,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC;QACnB,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,YAAY,EAAE,CAAC,CAAC,cAAc,CAAC;QAC/B,OAAO,EAAE,CAAC,CAAC,mCAAmC,CAAC;QAC/C,IAAI,EAAE,CAAC,CAAC,gCAAgC,CAAC;QACzC,SAAS,EAAE,CAAC,CAAC,sCAAsC,CAAC;QACpD,MAAM,EAAE,CAAC,CAAC,kCAAkC,CAAC;QAC7C,KAAK,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,iCAAiC,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QACjF,YAAY,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,yCAAyC,EAAE,EAAE,CAAC,EAAE,CAAC;QACtE,gBAAgB,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,6CAA6C,EAAE,EAAE,CAAC,EAAE,CAAC;QAC9E,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,kCAAkC,EAAE,EAAE,CAAC,EAAE,CAAC;QAC9D,aAAa,EAAE,CAAC,CAAC,0CAA0C,CAAC;KAC7D,CAAA;AACH,CAAC","sourcesContent":["import { Borders, Style, Workbook, Worksheet } from 'exceljs'\n\nimport { newestFirst, todayOf } from './employee-profile-rules'\n\n/*\n * The employee profiles a quotation attaches, as a document a person can hand in as it is (ADR-0169 decisions 6 · 8):\n * a page a person, made to show what the person is worth - the name large with where they stand, the figures a buyer\n * weighs (total experience, projects delivered, certificates held), the expertise in their own words and skills, then\n * the projects first, the careers, certificates and education - laid out for A4. Several people open with a roster.\n *\n * One layout (`profileSheetLayout`, `rosterLayout`) is painted twice: as an Excel workbook, a sheet a page\n * (`profileWorkbook`), and as HTML printed to PDF, a page break a sheet (`profileHtml`). Pure - the door reads the data\n * and the pdf module prints.\n */\n\n/** A row of any of the four tables - each has some of these. */\ntype Row = {\n school?: string\n major?: string\n degree?: string\n name?: string\n issuer?: string\n acquiredOn?: string\n company?: string\n department?: string\n position?: string\n duties?: string\n client?: string\n role?: string\n technologies?: string\n startedOn?: string\n endedOn?: string\n}\n\nexport type ProfilePerson = {\n name?: string | null\n departmentName?: string | null\n jobPosition?: string | null\n jobResponsibility?: string | null\n hiredOn?: string | null\n profile?: {\n summary?: string | null\n skills?: string[] | null\n educations?: Row[] | null\n certificates?: Row[] | null\n careers?: Row[] | null\n projects?: Row[] | null\n } | null\n}\n\n/** The words of the document, in the reader's language - handed in so this stays free of i18next. */\nexport type ProfileSheetWords = Record<\n | 'title'\n | 'rosterTitle'\n | 'expertise'\n | 'name'\n | 'department'\n | 'jobPosition'\n | 'hiredOn'\n | 'careerLength'\n | 'projectsDone'\n | 'certificatesHeld'\n | 'summary'\n | 'skills'\n | 'educations'\n | 'certificates'\n | 'careers'\n | 'projects'\n | 'school'\n | 'major'\n | 'degree'\n | 'period'\n | 'certificate'\n | 'issuer'\n | 'acquiredOn'\n | 'company'\n | 'position'\n | 'duties'\n | 'project'\n | 'client'\n | 'role'\n | 'technologies'\n | 'ongoing'\n | 'none'\n | 'writtenOn'\n | 'averageCareer'\n | 'number',\n string\n> & {\n /** 「12년 3개월」 */\n years: (years: number, months: number) => string\n /** 「8건」 */\n projectCount: (count: number) => string\n /** 「3개」 */\n certificateCount: (count: number) => string\n /** 「5명」 */\n peopleCount: (count: number) => string\n}\n\n/** What a cell is - the painter styles by it. */\nexport type CellRole =\n | 'company'\n | 'kicker'\n | 'name'\n | 'tagline'\n | 'rule'\n | 'statLabel'\n | 'statValue'\n | 'section'\n | 'summary'\n | 'label'\n | 'skills'\n | 'head'\n | 'value'\n | 'none'\n\n/**\n * A cell of the six-column grid: `col` from 1, spanning `span` columns and `rows` lines - the lines below leave its\n * columns out. A cell over several lines keeps its text where the first line has it, at the top.\n */\nexport type LayoutCell = { col: number; span?: number; rows?: number; value: string; role: CellRole }\n\n/** A line of the grid; `zebra` shades every other row of a table. */\nexport type LayoutLine = { cells: LayoutCell[]; height?: number; zebra?: boolean }\n\n/** The grid's six columns, in characters - together about the width of A4 in portrait. */\nexport const COLUMN_WIDTHS = [18, 20, 15, 12, 21, 18]\n\n/** The roster's six columns: a narrow number, then who - its career spans the last two, its skills the whole line. */\nexport const ROSTER_WIDTHS = [6, 24, 24, 18, 16, 16]\n\n/** 「2023.03」 from 「2023-03」 or 「2023-03-02」 - the dotted form a staffing profile is read in. */\nexport function dotted(day?: string | null): string {\n return (day ?? '').trim().replace(/-/g, '.')\n}\n\n/** A period as one cell - an open end is still going on. */\nexport function periodOf(startedOn: string | undefined, endedOn: string | undefined, ongoing: string): string {\n if (!startedOn && !endedOn) return ''\n return `${dotted(startedOn)} ~ ${endedOn ? dotted(endedOn) : ongoing}`.trim()\n}\n\nconst monthIndex = (day?: string | null): number | null => {\n const match = /^(\\d{4})-(\\d{2})/.exec((day ?? '').trim())\n return match ? Number(match[1]) * 12 + Number(match[2]) - 1 : null\n}\n\n/**\n * The months a person has worked: the careers before this company and the time here since the hire day, counted\n * once where they overlap. A career with no end runs to `today`; one with no start is left out.\n */\nexport function careerMonths(person: ProfilePerson, today = new Date()): number {\n const now = today.getFullYear() * 12 + today.getMonth()\n const months = new Set<number>()\n const spans = [\n ...(person.profile?.careers ?? []).map(row => [monthIndex(row.startedOn), row.endedOn ? monthIndex(row.endedOn) : now] as const),\n [monthIndex(person.hiredOn), now] as const\n ]\n for (const [from, to] of spans) {\n if (from === null || to === null) continue\n for (let month = from; month <= Math.min(to, now); month++) months.add(month)\n }\n return months.size\n}\n\nexport function careerLengthOf(person: ProfilePerson, words: ProfileSheetWords, today = new Date()): string {\n const months = careerMonths(person, today)\n return months ? words.years(Math.floor(months / 12), months % 12) : ''\n}\n\n/** Where the person stands, in one line: department · position / responsibility · hired on. */\nexport function taglineOf(person: ProfilePerson, words: ProfileSheetWords): string {\n const role = [person.jobPosition, person.jobResponsibility].filter(Boolean).join(' / ')\n return [person.departmentName, role, person.hiredOn ? `${words.hiredOn} ${dotted(person.hiredOn)}` : ''].filter(Boolean).join(' · ')\n}\n\n/** The head every page opens with: the employer and what the page is, the name large, a line under it. */\nfunction headOf(company: string, kicker: string, name: string, tagline: string): LayoutLine[] {\n return [\n {\n cells: [\n { col: 1, span: 3, value: company, role: 'company' },\n { col: 4, span: 3, value: kicker, role: 'kicker' }\n ]\n },\n { cells: [{ col: 1, span: 6, value: name, role: 'name' }], height: 40 },\n { cells: [{ col: 1, span: 6, value: tagline, role: 'tagline' }], height: 20 },\n { cells: [{ col: 1, span: 6, value: '', role: 'rule' }], height: 6 }\n ]\n}\n\n/** One person's page, line by line. `company` is the employer's name; `today` the day it is written. */\nexport function profileSheetLayout(person: ProfilePerson, words: ProfileSheetWords, company: string, today = new Date()): LayoutLine[] {\n const profile = person.profile ?? {}\n const lines: LayoutLine[] = [...headOf(company, words.title, person.name ?? '', taglineOf(person, words))]\n const gap = (height = 12) => lines.push({ cells: [], height })\n const section = (title: string) => {\n gap(16)\n lines.push({ cells: [{ col: 1, span: 6, value: title, role: 'section' }], height: 24 })\n gap(6)\n }\n\n /* A table: its head and its rows in the columns given as [col, span], every other row shaded; none says so. */\n const table = (title: string, columns: [number, number, string][], rows: Row[] | null | undefined, cells: (row: Row) => (string | undefined)[]) => {\n section(title)\n lines.push({ cells: columns.map(([col, span, head]) => ({ col, span, value: head, role: 'head' })) })\n if (!rows?.length) return lines.push({ cells: [{ col: 1, span: 6, value: words.none, role: 'none' }] })\n rows.forEach((row, index) =>\n lines.push({\n cells: cells(row).map((text, at) => ({ col: columns[at][0], span: columns[at][1], value: text ?? '', role: 'value' })),\n ...(index % 2 ? { zebra: true } : {})\n })\n )\n }\n\n /* The figures a buyer weighs first. */\n const projects = profile.projects?.length ?? 0\n const certificates = profile.certificates?.length ?? 0\n gap(14)\n lines.push({\n cells: [\n { col: 1, span: 2, value: words.careerLength, role: 'statLabel' },\n { col: 3, span: 2, value: words.projectsDone, role: 'statLabel' },\n { col: 5, span: 2, value: words.certificatesHeld, role: 'statLabel' }\n ],\n height: 20\n })\n lines.push({\n cells: [\n { col: 1, span: 2, value: careerLengthOf(person, words, today) || '—', role: 'statValue' },\n { col: 3, span: 2, value: projects ? words.projectCount(projects) : '—', role: 'statValue' },\n { col: 5, span: 2, value: certificates ? words.certificateCount(certificates) : '—', role: 'statValue' }\n ],\n height: 34\n })\n\n section(words.expertise)\n if (profile.summary?.trim()) lines.push({ cells: [{ col: 1, span: 6, value: profile.summary.trim(), role: 'summary' }] })\n lines.push({\n cells: [\n { col: 1, value: words.skills, role: 'label' },\n { col: 2, span: 5, value: (profile.skills ?? []).join(', '), role: 'skills' }\n ]\n })\n\n table(\n words.projects,\n [[1, 1, words.period], [2, 1, words.project], [3, 1, words.client], [4, 1, words.role], [5, 1, words.duties], [6, 1, words.technologies]],\n newestFirst(profile.projects),\n row => [periodOf(row.startedOn, row.endedOn, words.ongoing), row.name, row.client, row.role, row.duties, row.technologies]\n )\n table(\n words.careers,\n [[1, 1, words.period], [2, 1, words.company], [3, 1, words.department], [4, 1, words.position], [5, 2, words.duties]],\n newestFirst(profile.careers),\n row => [periodOf(row.startedOn, row.endedOn, words.ongoing), row.company, row.department, row.position, row.duties]\n )\n table(words.certificates, [[1, 1, words.acquiredOn], [2, 3, words.certificate], [5, 2, words.issuer]], newestFirst(profile.certificates), row => [\n dotted(row.acquiredOn),\n row.name,\n row.issuer\n ])\n table(words.educations, [[1, 1, words.period], [2, 2, words.school], [4, 2, words.major], [6, 1, words.degree]], newestFirst(profile.educations), row => [\n periodOf(row.startedOn, row.endedOn, words.ongoing),\n row.school,\n row.major,\n row.degree\n ])\n return lines\n}\n\n/** How many people, and their experience on average - the team's weight in one line. */\nexport function rosterTaglineOf(people: ProfilePerson[], words: ProfileSheetWords, today = new Date()): string {\n const months = people.map(person => careerMonths(person, today))\n const average = people.length ? Math.round(months.reduce((sum, one) => sum + one, 0) / people.length) : 0\n return [words.peopleCount(people.length), average ? `${words.averageCareer} ${words.years(Math.floor(average / 12), average % 12)}` : ''].filter(Boolean).join(' · ')\n}\n\n/** The roster that opens a document of several people - one line a person, in the order picked. */\nexport function rosterLayout(people: ProfilePerson[], words: ProfileSheetWords, company: string, today = new Date()): LayoutLine[] {\n return [\n ...headOf(company, `${words.writtenOn} ${dotted(todayOf(today))}`, words.rosterTitle, rosterTaglineOf(people, words, today)),\n { cells: [], height: 16 },\n {\n cells: [\n ...[words.number, words.name, words.department, words.jobPosition].map((value, index) => ({ col: index + 1, value, role: 'head' as const })),\n { col: 5, span: 2, value: words.careerLength, role: 'head' as const }\n ]\n },\n /*\n * Two lines a person: who, then the skills under the name across the rest of the page - a list too long for one\n * column of six. The number runs down both lines, so it marks where a person starts; a person with no skills\n * written keeps one line.\n */\n ...people.flatMap((person, index) => {\n const shade = index % 2 ? { zebra: true } : {}\n const skills = (person.profile?.skills ?? []).join(', ')\n return [\n {\n cells: [\n { col: 1, rows: skills ? 2 : 1, value: String(index + 1), role: 'value' as const },\n ...[person.name ?? '', person.departmentName ?? '', person.jobPosition ?? ''].map((value, column) => ({ col: column + 2, value, role: 'value' as const })),\n { col: 5, span: 2, value: careerLengthOf(person, words, today), role: 'value' as const }\n ],\n ...shade\n },\n ...(skills\n ? [\n {\n cells: [{ col: 2, span: 5, value: skills, role: 'value' as const }],\n ...shade\n }\n ]\n : [])\n ]\n })\n ]\n}\n\n/**\n * A sheet name for each person. Excel takes at most 31 characters, none of \\ / ? * [ ] :, and no two alike ignoring\n * case - two people of one name become 「홍길동」 and 「홍길동 (2)」. `reserved` are names already in the book.\n */\nexport function sheetNamesOf(names: (string | null | undefined)[], reserved: string[] = []): string[] {\n const taken = new Set<string>(reserved.map(name => name.toLowerCase()))\n return names.map((name, index) => {\n const base = (name ?? '').replace(/[\\\\/?*[\\]:]/g, ' ').replace(/^'+|'+$/g, '').trim() || `#${index + 1}`\n let candidate = base.slice(0, 31)\n for (let n = 2; taken.has(candidate.toLowerCase()); n++) {\n const tail = ` (${n})`\n candidate = base.slice(0, 31 - tail.length) + tail\n }\n taken.add(candidate.toLowerCase())\n return candidate\n })\n}\n\n/** The document's colours - a deep navy for what leads the eye, a pale blue-grey ground, quiet lines. */\nexport const PALETTE = { navy: '1F3A5F', ground: 'EEF3F8', zebra: 'F7F9FB', line: 'C9D2DC', ink: '17242C', muted: '5F6B76' }\n\nconst FONT = 'Malgun Gothic'\nconst argb = (hex: string) => ({ argb: `FF${hex}` })\nconst LINE = { style: 'thin' as const, color: argb(PALETTE.line) }\nconst RULED: Partial<Borders> = { top: LINE, left: LINE, bottom: LINE, right: LINE }\nconst ground = (hex: string) => ({ type: 'pattern' as const, pattern: 'solid' as const, fgColor: argb(hex) })\nconst font = (size: number, extra: Partial<Style['font']> = {}) => ({ name: FONT, size, color: argb(PALETTE.ink), ...extra })\n\n/** How each role of cell is painted in Excel. */\nconst PAINT: Record<CellRole, Partial<Style>> = {\n company: { font: font(9, { color: argb(PALETTE.muted) }), alignment: { horizontal: 'left', vertical: 'bottom' } },\n kicker: { font: font(9, { bold: true, color: argb(PALETTE.navy) }), alignment: { horizontal: 'right', vertical: 'bottom' } },\n name: { font: font(22, { bold: true, color: argb(PALETTE.navy) }), alignment: { horizontal: 'left', vertical: 'bottom' } },\n tagline: { font: font(10.5, { color: argb(PALETTE.muted) }), alignment: { horizontal: 'left', vertical: 'top' } },\n rule: { border: { bottom: { style: 'thick', color: argb(PALETTE.navy) } } },\n statLabel: {\n font: font(9, { color: argb(PALETTE.muted) }),\n fill: ground(PALETTE.ground),\n alignment: { horizontal: 'center', vertical: 'bottom' },\n border: { top: { style: 'medium', color: argb(PALETTE.navy) } }\n },\n statValue: { font: font(16, { bold: true, color: argb(PALETTE.navy) }), fill: ground(PALETTE.ground), alignment: { horizontal: 'center', vertical: 'middle' } },\n section: { font: font(12, { bold: true, color: argb(PALETTE.navy) }), alignment: { horizontal: 'left', vertical: 'bottom' }, border: { bottom: { style: 'medium', color: argb(PALETTE.navy) } } },\n summary: {\n font: font(10.5),\n fill: ground(PALETTE.ground),\n alignment: { horizontal: 'left', vertical: 'middle', wrapText: true, indent: 1 },\n border: { left: { style: 'thick', color: argb(PALETTE.navy) } }\n },\n label: { font: font(9.5, { bold: true, color: argb(PALETTE.navy) }), fill: ground(PALETTE.ground), alignment: { horizontal: 'center', vertical: 'middle', wrapText: true }, border: RULED },\n skills: { font: font(10, { bold: true }), alignment: { horizontal: 'left', vertical: 'middle', wrapText: true, indent: 1 }, border: RULED },\n head: {\n font: font(9.5, { bold: true, color: argb('FFFFFF') }),\n fill: ground(PALETTE.navy),\n alignment: { horizontal: 'center', vertical: 'middle', wrapText: true },\n border: { top: { style: 'thin', color: argb(PALETTE.navy) }, bottom: { style: 'thin', color: argb(PALETTE.navy) }, left: LINE, right: LINE }\n },\n value: { font: font(9.5), alignment: { horizontal: 'left', vertical: 'middle', wrapText: true, indent: 1 }, border: RULED },\n none: { font: font(9.5, { color: argb(PALETTE.muted) }), alignment: { horizontal: 'center', vertical: 'middle' }, border: RULED }\n}\n\n/**\n * A line's height in points, for as many text lines as its longest boxed cell wraps into - Excel does not grow a row\n * for wrapped text written by a program. A full-width character is about two of the column's character units.\n */\nexport function heightOf(line: LayoutLine, widths = COLUMN_WIDTHS): number | undefined {\n const boxed = line.cells.filter(cell => ['label', 'skills', 'summary', 'head', 'value', 'none'].includes(cell.role))\n if (!boxed.length) return undefined\n const wraps = boxed.map(cell => {\n const width = widths.slice(cell.col - 1, cell.col - 1 + (cell.span ?? 1)).reduce((sum, one) => sum + one, 0) - (cell.role === 'summary' ? 4 : 1)\n return cell.value.split('\\n').reduce((lines, text) => {\n const units = [...text].reduce((sum, char) => sum + (char.charCodeAt(0) > 0x2e7f ? 1.9 : 0.9), 0)\n return lines + Math.max(1, Math.ceil(units / Math.max(width, 1)))\n }, 0)\n })\n const lines = Math.max(...wraps)\n return boxed.some(cell => cell.role === 'summary') ? lines * 16 + 14 : lines * 15 + 7\n}\n\n/** Paint a layout on a sheet: values, spans merged, each cell of a span painted so a boxed cell is boxed all round. */\nexport function paintSheet(sheet: Worksheet, lines: LayoutLine[], footer = '', widths = COLUMN_WIDTHS) {\n widths.forEach((width, index) => (sheet.getColumn(index + 1).width = width))\n lines.forEach((line, index) => {\n const row = sheet.getRow(index + 1)\n const height = Math.max(line.height ?? 0, heightOf(line, widths) ?? 0)\n if (height) row.height = height\n for (const cell of line.cells) {\n const span = cell.span ?? 1\n const style = line.zebra && cell.role === 'value' ? { ...PAINT.value, fill: ground(PALETTE.zebra) } : PAINT[cell.role]\n const rows = cell.rows ?? 1\n const painted = rows > 1 ? { ...style, alignment: { ...style.alignment, vertical: 'top' as const } } : style\n for (let at = 0; at < rows; at++) for (let col = cell.col; col < cell.col + span; col++) Object.assign(sheet.getRow(index + 1 + at).getCell(col), { style: painted })\n row.getCell(cell.col).value = cell.value\n if (span > 1 || rows > 1) sheet.mergeCells(index + 1, cell.col, index + rows, cell.col + span - 1)\n }\n })\n sheet.views = [{ showGridLines: false }]\n sheet.pageSetup = {\n paperSize: 9,\n orientation: 'portrait',\n fitToPage: true,\n fitToWidth: 1,\n fitToHeight: 0,\n horizontalCentered: true,\n margins: { left: 0.5, right: 0.5, top: 0.6, bottom: 0.7, header: 0.3, footer: 0.3 }\n }\n /* The employer at the foot of every printed page, and the page of how many. `&` is Excel's escape. */\n sheet.headerFooter = { oddFooter: `&L&8${footer.replace(/&/g, '&&')}&R&8&P / &N` }\n}\n\n/** The workbook of the people given, in their order - opened by a roster when there are several. */\nexport function profileWorkbook(people: ProfilePerson[], words: ProfileSheetWords, company: string, today = new Date()): Workbook {\n const book = new Workbook()\n const footer = [company, words.title].filter(Boolean).join(' · ')\n /* The roster's name follows Excel's rules as the people's do. */\n const roster = people.length > 1 ? sheetNamesOf([words.rosterTitle]) : []\n if (roster.length) paintSheet(book.addWorksheet(roster[0]), rosterLayout(people, words, company, today), footer, ROSTER_WIDTHS)\n const names = sheetNamesOf(people.map(person => person.name), roster)\n people.forEach((person, index) => paintSheet(book.addWorksheet(names[index]), profileSheetLayout(person, words, company, today), footer))\n return book\n}\n\nconst escapeHtml = (text: string) => text.replace(/[&<>\"]/g, c => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '\"': '&quot;' })[c]!)\n\n/** A cell's content as HTML: skills as tags, line breaks kept, everything escaped. */\nfunction cellHtml(cell: LayoutCell): string {\n if (cell.role === 'skills') {\n return cell.value\n .split(', ')\n .filter(Boolean)\n .map(skill => `<span class=\"tag\">${escapeHtml(skill)}</span>`)\n .join('')\n }\n return escapeHtml(cell.value).replace(/\\n/g, '<br>')\n}\n\n/** The same layout as HTML: a table of the six columns a page, the roles as classes. */\nexport function layoutHtml(lines: LayoutLine[], widths = COLUMN_WIDTHS): string {\n const total = widths.reduce((sum, width) => sum + width, 0)\n const columns = widths.map(width => `<col style=\"width:${((width / total) * 100).toFixed(2)}%\">`).join('')\n /* How many more lines each column is still held by a cell from a line above. */\n const held = [0, 0, 0, 0, 0, 0, 0]\n const rows = lines.map(line => {\n const style = line.height ? ` style=\"height:${Math.round(line.height * 1.33)}px\"` : ''\n const covered = held.map(lines => lines > 0)\n for (let col = 1; col <= 6; col++) held[col] = Math.max(0, held[col] - 1)\n if (!line.cells.length) return `<tr class=\"gap\"${style}><td colspan=\"6\"></td></tr>`\n const cells: string[] = []\n /* Empty columns between cells, as runs that leave out the columns a cell above still holds. */\n const fill = (from: number, to: number) => {\n for (let col = from; col < to; ) {\n if (covered[col]) {\n col++\n continue\n }\n let end = col\n while (end < to && !covered[end]) end++\n cells.push(`<td colspan=\"${end - col}\"></td>`)\n col = end\n }\n }\n let next = 1\n for (const cell of line.cells) {\n fill(next, cell.col)\n const span = cell.span ?? 1\n const rows = cell.rows ?? 1\n for (let col = cell.col; col < cell.col + span; col++) held[col] = rows - 1\n const attributes = `${span > 1 ? ` colspan=\"${span}\"` : ''}${rows > 1 ? ` rowspan=\"${rows}\" style=\"vertical-align:top\"` : ''}`\n cells.push(`<td class=\"${cell.role}\"${attributes}>${cellHtml(cell)}</td>`)\n next = cell.col + span\n }\n fill(next, 7)\n return `<tr${line.zebra ? ' class=\"zebra\"' : ''}${style}>${cells.join('')}</tr>`\n })\n return `<table><colgroup>${columns}</colgroup>${rows.join('')}</table>`\n}\n\n/** How the roles look on paper - the workbook's paint in CSS. */\nexport const PROFILE_CSS = `\nbody { margin: 0; font-family: 'Pretendard', 'Malgun Gothic', 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif; font-size: 9.5pt; color: #${PALETTE.ink};\n -webkit-print-color-adjust: exact; print-color-adjust: exact }\n.sheet { break-after: page }\n.sheet:last-child { break-after: auto }\ntable { width: 100%; border-collapse: collapse; table-layout: fixed }\ntd { padding: 5px 7px; vertical-align: middle; word-break: keep-all; overflow-wrap: anywhere; line-height: 1.45 }\ntr.gap td { padding: 0 }\ntd.company { font-size: 8.5pt; color: #${PALETTE.muted}; padding: 0 0 2px }\ntd.kicker { font-size: 8.5pt; font-weight: 700; color: #${PALETTE.navy}; text-align: right; letter-spacing: 0.08em; padding: 0 0 2px }\ntd.name { font-size: 24pt; font-weight: 800; color: #${PALETTE.navy}; letter-spacing: 0.02em; padding: 6px 0 0; vertical-align: bottom }\ntd.tagline { font-size: 10.5pt; color: #${PALETTE.muted}; padding: 2px 0 8px; vertical-align: top }\ntd.rule { border-bottom: 3px solid #${PALETTE.navy}; padding: 0 }\ntd.statLabel { background: #${PALETTE.ground}; border-top: 2px solid #${PALETTE.navy}; text-align: center; font-size: 8.5pt; color: #${PALETTE.muted}; padding: 8px 0 0 }\ntd.statValue { background: #${PALETTE.ground}; text-align: center; font-size: 17pt; font-weight: 800; color: #${PALETTE.navy}; padding: 0 0 8px }\ntd.statLabel + td.statLabel, td.statValue + td.statValue { border-left: 8px solid #fff }\ntd.section { font-size: 12pt; font-weight: 800; color: #${PALETTE.navy}; border-bottom: 2px solid #${PALETTE.navy}; padding: 0 0 4px; vertical-align: bottom }\ntd.summary { background: #${PALETTE.ground}; border-left: 4px solid #${PALETTE.navy}; font-size: 10.5pt; padding: 10px 14px }\ntd.label { background: #${PALETTE.ground}; color: #${PALETTE.navy}; font-weight: 700; text-align: center; border: 1px solid #${PALETTE.line} }\ntd.skills { border: 1px solid #${PALETTE.line}; padding: 6px 8px }\n.tag { display: inline-block; margin: 2px 4px 2px 0; padding: 2px 9px; border-radius: 10px; background: #${PALETTE.navy}; color: #fff; font-size: 8.5pt; font-weight: 600 }\ntd.head { background: #${PALETTE.navy}; color: #fff; font-weight: 700; text-align: center; border: 1px solid #${PALETTE.navy}; font-size: 9pt }\ntd.value { border: 1px solid #${PALETTE.line} }\ntr.zebra td.value { background: #${PALETTE.zebra} }\ntd.none { border: 1px solid #${PALETTE.line}; color: #${PALETTE.muted}; text-align: center }\ntr { break-inside: avoid }\n`\n\n/** On a screen, the pages as sheets of A4 on a grey desk - the preview reads as the PDF will (ADR-0169 decision 9). */\nexport const PROFILE_SCREEN_CSS = `\n@media screen {\n html { background: #e9edf1 }\n body { padding: 24px 0 }\n .sheet { box-sizing: border-box; width: 210mm; min-height: 297mm; margin: 0 auto 24px; padding: 14mm 12mm; background: #fff;\n box-shadow: 0 1px 3px rgba(23, 36, 44, .12), 0 8px 24px rgba(23, 36, 44, .08) }\n}\n`\n\n/** The preview: the same pages as one HTML document, to be shown in a frame. */\nexport function profilePreviewHtml(people: ProfilePerson[], words: ProfileSheetWords, company: string, today = new Date()): string {\n return `<!doctype html><html><head><meta charset=\"utf-8\"><style>${PROFILE_CSS}${PROFILE_SCREEN_CSS}</style></head><body>${profileHtml(people, words, company, today)}</body></html>`\n}\n\n/** The document as one HTML page set: the roster first when there are several, then a page a person. */\nexport function profileHtml(people: ProfilePerson[], words: ProfileSheetWords, company: string, today = new Date()): string {\n const sheets: [LayoutLine[], number[]][] = [\n ...(people.length > 1 ? [[rosterLayout(people, words, company, today), ROSTER_WIDTHS] as [LayoutLine[], number[]]] : []),\n ...people.map(person => [profileSheetLayout(person, words, company, today), COLUMN_WIDTHS] as [LayoutLine[], number[]])\n ]\n return sheets.map(([lines, widths]) => `<section class=\"sheet\">${layoutHtml(lines, widths)}</section>`).join('')\n}\n\n/** The foot of every printed PDF page: the employer and the document at the left, the page of how many at the right. */\nexport function profileFooterHtml(company: string, words: ProfileSheetWords): string {\n /* The footer is a Handlebars template in the pdf module - a brace in the name must not open one. */\n const left = escapeHtml([company, words.title].filter(Boolean).join(' · ')).replace(/[{}]/g, c => (c === '{' ? '&#123;' : '&#125;'))\n return (\n `<div style=\"width:100%;padding:0 12mm;display:flex;justify-content:space-between;font-family:'Malgun Gothic','Apple SD Gothic Neo','Noto Sans KR',sans-serif;` +\n `font-size:7.5pt;color:#${PALETTE.muted}\"><span>${left}</span><span><span class=\"pageNumber\"></span> / <span class=\"totalPages\"></span></span></div>`\n )\n}\n\n/** 「인력프로필-20261027.xlsx」 - the word in the reader's language, the day the profiles were taken. */\nexport function profileFileName(word: string, extension: 'xlsx' | 'pdf' | 'html', day = new Date()): string {\n const pad = (n: number) => String(n).padStart(2, '0')\n return `${word}-${day.getFullYear()}${pad(day.getMonth() + 1)}${pad(day.getDate())}.${extension}`\n}\n\n/** A word as a document heads with it - its first letter capital where the language has capitals (「proyectos」 → 「Proyectos」). */\nexport function lead(word: string): string {\n return word ? word.charAt(0).toLocaleUpperCase() + word.slice(1) : word\n}\n\n/** The document's words from the server's translator - the reader's language, each as a heading begins. */\nexport function profileWordsOf(translate: (key: string, options?: any) => string): ProfileSheetWords {\n const t = (key: string, options?: any) => lead(translate(key, options))\n const p = (name: string) => t(`label.employee-profile-${name}`)\n return {\n title: t('text.employee-profile-doc-title'),\n rosterTitle: t('text.employee-profile-doc-roster'),\n expertise: t('text.employee-profile-doc-expertise'),\n name: t('field.name'),\n department: t('label.department'),\n jobPosition: t('label.job-position'),\n hiredOn: t('label.hired-on'),\n careerLength: p('career-length'),\n projectsDone: t('text.employee-profile-doc-projects-done'),\n certificatesHeld: t('text.employee-profile-doc-certificates-held'),\n summary: p('summary'),\n skills: p('skills'),\n educations: p('educations'),\n certificates: p('certificates'),\n careers: p('careers'),\n projects: p('projects'),\n school: p('school'),\n major: p('major'),\n degree: p('degree'),\n period: p('period'),\n certificate: p('certificate'),\n issuer: p('issuer'),\n acquiredOn: p('acquired-on'),\n company: p('company'),\n position: p('position'),\n duties: p('duties'),\n project: p('project'),\n client: p('client'),\n role: p('role'),\n technologies: p('technologies'),\n ongoing: t('text.employee-profile-doc-ongoing'),\n none: t('text.employee-profile-doc-none'),\n writtenOn: t('text.employee-profile-doc-written-on'),\n number: t('text.employee-profile-doc-number'),\n years: (years, months) => t('text.employee-profile-doc-years', { years, months }),\n projectCount: n => t('text.employee-profile-doc-project-count', { n }),\n certificateCount: n => t('text.employee-profile-doc-certificate-count', { n }),\n peopleCount: n => t('text.employee-profile-doc-people', { n }),\n averageCareer: t('text.employee-profile-doc-average-career')\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"employee-profile-mutation.js","sourceRoot":"","sources":["../../../server/service/employee-profile/employee-profile-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AAEtE,iDAAqD;AAErD,+DAA8D;AAC9D,yDAAoD;AACpD,qEAA4E;AAC5E,mEAA8D;AAE9D;;;GAGG;AAEI,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAM5B,AAAN,KAAK,CAAC,qBAAqB,CAA+C,OAA6B,EAAS,OAAwB;QACtI,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAC1C,MAAM,QAAQ,GAAG,MAAM,IAAA,kCAAiB,EAAC,OAAO,CAAC,CAAA;QACjD,MAAM,UAAU,GAAG,IAAA,qBAAa,EAAC,kCAAe,EAAE,EAAE,CAAC,CAAA;QACrD,MAAM,IAAI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E,CAAC;YAChD,GAAG,IAAA,uCAAc,EAAC,IAAW,EAAE,OAAO,CAAC;YACvC,OAAO,EAAE,IAAI;SACc,CAAC,CAAA;QAE9B,OAAO,MAAM,UAAU,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,CAAA;IAC9D,CAAC;CACF,CAAA;AA7CY,0DAAuB;AAM5B;IALL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,wBAAS,EAAC,wFAAwF,CAAC;IACnG,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,kCAAe,EAAE;QACpC,WAAW,EAAE,qIAAqI;KACnJ,CAAC;IAC2B,mBAAA,IAAA,kBAAG,EAAC,SAAS,EAAE,IAAI,CAAC,EAAE,CAAC,4CAAoB,CAAC,CAAA;IAAiC,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CAA5B,4CAAoB;;oEAatG;AAYK;IALL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,wBAAS,EAAC,wFAAwF,CAAC;IACnG,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,kCAAe,EAAE;QACpC,WAAW,EAAE,0MAA0M;KACxN,CAAC;IAC4B,mBAAA,IAAA,kBAAG,EAAC,SAAS,EAAE,IAAI,CAAC,EAAE,CAAC,4CAAoB,CAAC,CAAA;IAAiC,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CAA5B,4CAAoB;;qEAavG;kCA5CU,uBAAuB;IADnC,IAAA,uBAAQ,EAAC,kCAAe,CAAC;GACb,uBAAuB,CA6CnC","sourcesContent":["import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'\n\nimport { getRepository } from '@things-factory/shell'\n\nimport { requireMyEmployee } from '../employee/my-employee.js'\nimport { EmployeeProfile } from './employee-profile'\nimport { addedProfileOf, profileDocumentOf } from './employee-profile-rules'\nimport { EmployeeProfileInput } from './employee-profile-type'\n\n/*\n * The employee writes their own profile and nobody else's (ADR-0169 decisions 3 · 4) - no door changes another\n * person's. It is saved as one document, as the screen holds it.\n */\n@Resolver(EmployeeProfile)\nexport class EmployeeProfileMutation {\n @Directive('@transaction')\n @Directive('@privilege(category: \"employee-self\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => EmployeeProfile, {\n description: \"Saves the caller's own profile whole - what is left out is emptied. Refused when the account is not linked to exactly one employee.\"\n })\n async saveMyEmployeeProfile(@Arg('profile', type => EmployeeProfileInput) profile: EmployeeProfileInput, @Ctx() context: ResolverContext): Promise<EmployeeProfile> {\n const { domain, user, tx } = context.state\n const employee = await requireMyEmployee(context)\n const repository = getRepository(EmployeeProfile, tx)\n const held = await repository.findOne({ where: { domain: { id: domain.id }, employee: { id: employee.id } } })\n\n const saved = await repository.save({\n ...(held ?? { domain, employee, creator: user }),\n ...profileDocumentOf(profile),\n updater: user\n } as Partial<EmployeeProfile>)\n\n return await repository.findOne({ where: { id: saved.id } })\n }\n\n /*\n * What the assistant read from a résumé the person attached, added to their own profile once they press the card\n * (ADR-0169 decision 10): nothing kept is taken away - a given summary takes the summary's place, skills and rows\n * are added unless already there.\n */\n @Directive('@transaction')\n @Directive('@privilege(category: \"employee-self\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => EmployeeProfile, {\n description: \"Adds to the caller's own profile: a given summary replaces the summary, skills and rows are added after those held unless already there. Refused when the account is not linked to exactly one employee.\"\n })\n async addToMyEmployeeProfile(@Arg('profile', type => EmployeeProfileInput) profile: EmployeeProfileInput, @Ctx() context: ResolverContext): Promise<EmployeeProfile> {\n const { domain, user, tx } = context.state\n const employee = await requireMyEmployee(context)\n const repository = getRepository(EmployeeProfile, tx)\n const held = await repository.findOne({ where: { domain: { id: domain.id }, employee: { id: employee.id } } })\n\n const saved = await repository.save({\n ...(held ?? { domain, employee, creator: user }),\n ...addedProfileOf(held as any, profile),\n updater: user\n } as Partial<EmployeeProfile>)\n\n return await repository.findOne({ where: { id: saved.id } })\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"employee-profile-query.js","sourceRoot":"","sources":["../../../server/service/employee-profile/employee-profile-query.ts"],"names":[],"mappings":";;;AAgFA,gDAMC;;AAtFD,+CAAkF;AAElF,6CAA4C;AAC5C,iDAA6E;AAC7E,6CAAgD;AAEhD,mDAA+C;AAC/C,+DAAwE;AACxE,yDAAoD;AACpD,qEAAyE;AACzE,2EAA+J;AAC/J,mEAAyG;AAEzG;;;;GAIG;AAGI,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAMzB,AAAN,KAAK,CAAC,iBAAiB,CAAQ,OAAwB;QACrD,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QACpC,MAAM,IAAI,GAAG,MAAM,IAAA,4BAAW,EAAC,OAAO,CAAC,CAAA;QACvC,IAAI,CAAC,IAAI,CAAC,MAAM;YAAE,OAAO,IAAI,CAAA;QAE7B,MAAM,QAAQ,GAAG,IAAA,+BAAc,EAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QAC9C,OAAO,MAAM,IAAA,qBAAa,EAAC,kCAAe,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,QAAQ,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAA;IAClI,CAAC;IAOK,AAAN,KAAK,CAAC,gBAAgB,CAAQ,OAAwB;QACpD,OAAO,MAAM,kBAAkB,CAAC,OAAO,CAAC,CAAA;IAC1C,CAAC;IAED;;;;OAIG;IAGG,AAAN,KAAK,CAAC,uBAAuB,CACuF,WAAqB,EACvD,MAA6B,EACsC,QAAgB,EAC5J,OAAwB;QAE/B,MAAM,QAAQ,GAAG,MAAM,kBAAkB,CAAC,OAAO,CAAC,CAAA;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AE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,YAAY,CAAC,EAAE,CAAC,CAAA;IAC7H,MAAM,QAAQ,GAAG,MAAM,IAAA,qBAAa,EAAC,kCAAe,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAA;IAExG,OAAO,IAAA,8CAAqB,EAAC,SAAS,EAAE,QAAQ,EAAE,IAAA,gCAAO,GAAE,CAAQ,CAAA;AACrE,CAAC","sourcesContent":["import { Arg, Ctx, Directive, Query, Resolver, UseMiddleware } from 'type-graphql'\n\nimport { config } from '@things-factory/env'\nimport { getRepository, Refusal, SpeakRefusals } from '@things-factory/shell'\nimport { PdfService } from '@things-factory/pdf'\n\nimport { Employee } from '../employee/employee'\nimport { myEmployees, theOneEmployee } from '../employee/my-employee.js'\nimport { EmployeeProfile } from './employee-profile'\nimport { employeesWithProfiles, todayOf } from './employee-profile-rules'\nimport { profileFileName, profileFooterHtml, PROFILE_CSS, profileHtml, profilePreviewHtml, profileWordsOf, profileWorkbook } from './employee-profile-document'\nimport { EmployeeProfileFile, EmployeeProfileFormat, EmployeeWithProfile } from './employee-profile-type'\n\n/*\n * Reading profiles (ADR-0169 decisions 3 · 4): one's own under `employee-self`, every active employee's under\n * `employee-profile` - the seats that attach profiles to quotations. Neither reads the employee record beyond the\n * basics a profile sheet shows.\n */\n@Resolver(EmployeeProfile)\n@UseMiddleware(SpeakRefusals)\nexport class EmployeeProfileQuery {\n @Directive('@privilege(category: \"employee-self\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(returns => EmployeeProfile, {\n nullable: true,\n description: \"Fetches the caller's own profile. Null when the caller has written none, or when the account is not linked to an employee (myEmployees tells which).\"\n })\n async myEmployeeProfile(@Ctx() context: ResolverContext): Promise<EmployeeProfile | null> {\n const { domain, tx } = context.state\n const mine = await myEmployees(context)\n if (!mine.length) return null\n\n const employee = theOneEmployee(mine, context)\n return await getRepository(EmployeeProfile, tx).findOne({ where: { domain: { id: domain.id }, employee: { id: employee.id } } })\n }\n\n @Directive('@privilege(category: \"employee-profile\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(returns => [EmployeeWithProfile], {\n description:\n 'Fetches every active employee of the domain - not retired, not marked inactive - with their name, department, position, responsibility, hire day and profile; the profile is empty when they have written none.'\n })\n async employeeProfiles(@Ctx() context: ResolverContext): Promise<EmployeeWithProfile[]> {\n return await activeWithProfiles(context)\n }\n\n /*\n * The chosen people's profiles as one file to hand in with a quotation - Excel or PDF, from one layout\n * (employee-profile-document.ts). Only active employees of the domain, in the order chosen; an id that is none of\n * them is left out. The employer's name is the domain's description, as the sign-in page shows it.\n */\n @Directive('@privilege(category: \"employee-profile\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(returns => EmployeeProfileFile, { description: \"Prints the chosen active employees' profiles as one Excel workbook or PDF, in the order chosen.\" })\n async employeeProfileDocument(\n @Arg('employeeIds', type => [String], { description: 'The employees, in the order their profiles are printed.' }) employeeIds: string[],\n @Arg('format', type => EmployeeProfileFormat, { description: 'Excel or PDF.' }) format: EmployeeProfileFormat,\n @Arg('language', { nullable: true, description: \"The language of the document's own words, one the application runs - the reader's when empty.\" }) language: string,\n @Ctx() context: ResolverContext\n ): Promise<EmployeeProfileFile> {\n const everyone = await activeWithProfiles(context)\n return await documentOf(employeeIds.map(id => everyone.find(one => one.employeeId === id)).filter(Boolean), format, context, language)\n }\n\n /* One's own profile as the document sales will hand in - to see it while writing it. */\n @Directive('@privilege(category: \"employee-self\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(returns => EmployeeProfileFile, { description: \"Prints the caller's own profile as the Excel workbook or PDF a quotation attaches.\" })\n async myEmployeeProfileDocument(\n @Arg('format', type => EmployeeProfileFormat, { description: 'Excel or PDF.' }) format: EmployeeProfileFormat,\n @Arg('language', { nullable: true, description: \"The language of the document's own words, one the application runs - the reader's when empty.\" }) language: string,\n @Ctx() context: ResolverContext\n ): Promise<EmployeeProfileFile> {\n const mine = theOneEmployee(await myEmployees(context), context)\n const everyone = await activeWithProfiles(context)\n return await documentOf(everyone.filter(one => one.employeeId === mine.id), format, context, language)\n }\n}\n\n/**\n * The translator of the document's own words: the language asked for, or the reader's. Only the words the document\n * itself prints follow it - names, summaries and projects stay as their employees wrote them. A language the\n * application does not run (`i18n.languages`) is refused rather than printed half in another.\n */\nexport function documentTranslator(context: any, language?: string | null): (key: string, options?: any) => string {\n if (!language) return (key, options) => String(context.t(key, options))\n const runs = ((config.get('i18n/languages', []) as { code?: string }[]) ?? []).map(one => one?.code)\n if (!runs.includes(language)) throw new Refusal('document-language-not-run', { language }, `The application does not run the language \"${language}\".`)\n const fixed = context.i18next.getFixedT(language)\n return (key, options) => String(fixed(key, options))\n}\n\n/** The people's profiles as one file - Excel or PDF from one layout, the employer named as the sign-in page names it. */\nasync function documentOf(people: EmployeeWithProfile[], format: EmployeeProfileFormat, context: ResolverContext, language?: string): Promise<EmployeeProfileFile> {\n const t = documentTranslator(context, language)\n const words = profileWordsOf(t)\n const company = context.state.domain.description || context.state.domain.name\n const word = t('text.employee-profile-file')\n\n if (format === EmployeeProfileFormat.HTML) {\n return { fileName: profileFileName(word, 'html'), mimeType: 'text/html', content: Buffer.from(profilePreviewHtml(people, words, company), 'utf8').toString('base64') }\n }\n\n if (format === EmployeeProfileFormat.PDF) {\n const body = `<style>${PROFILE_CSS}</style>${profileHtml(people, words, company)}`\n const pdf = await new PdfService().generatePdf({ content_template: '{{{body}}}', footer_template: profileFooterHtml(company, words), page_size: 'A4' }, { body })\n return { fileName: profileFileName(word, 'pdf'), mimeType: 'application/pdf', content: pdf.toString('base64') }\n }\n\n const buffer = await profileWorkbook(people, words, company).xlsx.writeBuffer()\n return {\n fileName: profileFileName(word, 'xlsx'),\n mimeType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n content: Buffer.from(buffer as ArrayBuffer).toString('base64')\n }\n}\n\n/** Every active employee of the domain with their profile - the list and the document read the same people. */\nasync function activeWithProfiles(context: ResolverContext): Promise<EmployeeWithProfile[]> {\n const { domain, tx } = context.state\n const employees = await getRepository(Employee, tx).find({ where: { domain: { id: domain.id } }, relations: ['department'] })\n const profiles = await getRepository(EmployeeProfile, tx).find({ where: { domain: { id: domain.id } } })\n\n return employeesWithProfiles(employees, profiles, todayOf()) as any\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"employee-profile-rows.js","sourceRoot":"","sources":["../../../server/service/employee-profile/employee-profile-rows.ts"],"names":[],"mappings":";;;;AAAA;;;GAGG;AACH,+CAA2D;AAIpD,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;CAepC,CAAA;AAfY,4DAAwB;AAEnC;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC;;wDACvC;AAGf;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,YAAY,EAAE,CAAC;;uDACvC;AAGd;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,wEAAwE,EAAE,CAAC;;wDAClG;AAGf;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,2BAA2B,EAAE,CAAC;;2DAClD;AAGlB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,mDAAmD,EAAE,CAAC;;yDAC5E;mCAdL,wBAAwB;IAFpC,IAAA,yBAAU,EAAC,0BAA0B,EAAE,EAAE,WAAW,EAAE,gCAAgC,EAAE,CAAC;IACzF,IAAA,wBAAS,EAAC,+BAA+B,EAAE,EAAE,WAAW,EAAE,gCAAgC,EAAE,CAAC;GACjF,wBAAwB,CAepC;AAIM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rows of an employee profile (ADR-0169 decision 2). Each shape is read and written alike - the same fields come back\n * as were saved - so it is one class, declared as an object type and, under another name, as its input.\n */\nimport { Field, InputType, ObjectType } from 'type-graphql'\n\n@ObjectType('EmployeeProfileEducation', { description: 'A school the employee went to.' })\n@InputType('EmployeeProfileEducationInput', { description: 'A school the employee went to.' })\nexport class EmployeeProfileEducation {\n @Field({ nullable: true, description: 'The school.' })\n school?: string\n\n @Field({ nullable: true, description: 'The major.' })\n major?: string\n\n @Field({ nullable: true, description: 'The degree or the stage finished - e.g. bachelor, master, high school.' })\n degree?: string\n\n @Field({ nullable: true, description: 'When it started, YYYY-MM.' })\n startedOn?: string\n\n @Field({ nullable: true, description: 'When it ended, YYYY-MM - empty while still at it.' })\n endedOn?: string\n}\n\n@ObjectType('EmployeeProfileCertificate', { description: 'A certificate or licence the employee holds.' })\n@InputType('EmployeeProfileCertificateInput', { description: 'A certificate or licence the employee holds.' })\nexport class EmployeeProfileCertificate {\n @Field({ nullable: true, description: 'The name of the certificate.' })\n name?: string\n\n @Field({ nullable: true, description: 'Who issued it.' })\n issuer?: string\n\n @Field({ nullable: true, description: 'The day it was acquired, YYYY-MM-DD.' })\n acquiredOn?: string\n}\n\n@ObjectType('EmployeeProfileCareer', { description: 'A job the employee held before - at another company.' })\n@InputType('EmployeeProfileCareerInput', { description: 'A job the employee held before - at another company.' })\nexport class EmployeeProfileCareer {\n @Field({ nullable: true, description: 'The company.' })\n company?: string\n\n @Field({ nullable: true, description: 'The department there.' })\n department?: string\n\n @Field({ nullable: true, description: 'The position there.' })\n position?: string\n\n @Field({ nullable: true, description: 'When it started, YYYY-MM.' })\n startedOn?: string\n\n @Field({ nullable: true, description: 'When it ended, YYYY-MM.' })\n endedOn?: string\n\n @Field({ nullable: true, description: 'What the employee did there.' })\n duties?: string\n}\n\n@ObjectType('EmployeeProfileProject', { description: 'A project the employee worked on.' })\n@InputType('EmployeeProfileProjectInput', { description: 'A project the employee worked on.' })\nexport class EmployeeProfileProject {\n @Field({ nullable: true, description: 'The name of the project.' })\n name?: string\n\n @Field({ nullable: true, description: 'Who ordered it - the client.' })\n client?: string\n\n @Field({ nullable: true, description: 'When the employee joined it, YYYY-MM.' })\n startedOn?: string\n\n @Field({ nullable: true, description: 'When the employee left it, YYYY-MM - empty while still on it.' })\n endedOn?: string\n\n @Field({ nullable: true, description: 'The role on it - e.g. PM, developer.' })\n role?: string\n\n @Field({ nullable: true, description: 'What the employee did on it.' })\n duties?: string\n\n @Field({ nullable: true, description: 'The technologies used, as written.' })\n technologies?: string\n}\n"]}