@things-factory/organization 10.0.18 → 10.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/dist-client/component/approval-line-brief.js +93 -36
  2. package/dist-client/component/approval-line-brief.js.map +1 -1
  3. package/dist-client/component/approval-line-items-editor-popup.d.ts +2 -0
  4. package/dist-client/component/approval-line-items-editor-popup.js +27 -9
  5. package/dist-client/component/approval-line-items-editor-popup.js.map +1 -1
  6. package/dist-client/component/approval-line-items-editor.d.ts +7 -1
  7. package/dist-client/component/approval-line-items-editor.js +67 -3
  8. package/dist-client/component/approval-line-items-editor.js.map +1 -1
  9. package/dist-client/component/approval-line-selector.d.ts +2 -0
  10. package/dist-client/component/approval-line-selector.js +40 -9
  11. package/dist-client/component/approval-line-selector.js.map +1 -1
  12. package/dist-client/component/approval-line-view.d.ts +15 -0
  13. package/dist-client/component/approval-line-view.js +177 -41
  14. package/dist-client/component/approval-line-view.js.map +1 -1
  15. package/dist-client/component/assignees-editor-popup.d.ts +2 -0
  16. package/dist-client/component/assignees-editor-popup.js +27 -8
  17. package/dist-client/component/assignees-editor-popup.js.map +1 -1
  18. package/dist-client/component/department-selector.d.ts +2 -0
  19. package/dist-client/component/department-selector.js +27 -8
  20. package/dist-client/component/department-selector.js.map +1 -1
  21. package/dist-client/component/recipients-editor-popup.d.ts +2 -0
  22. package/dist-client/component/recipients-editor-popup.js +27 -8
  23. package/dist-client/component/recipients-editor-popup.js.map +1 -1
  24. package/dist-client/filters-form/ox-filter-department-object.js +11 -1
  25. package/dist-client/filters-form/ox-filter-department-object.js.map +1 -1
  26. package/dist-client/pages/approval-line/approval-line-list-page.d.ts +121 -0
  27. package/dist-client/pages/approval-line/approval-line-list-page.js +583 -0
  28. package/dist-client/pages/approval-line/approval-line-list-page.js.map +1 -0
  29. package/dist-client/pages/approval-line/common-approval-line-templates-page.d.ts +0 -2
  30. package/dist-client/pages/approval-line/common-approval-line-templates-page.js +27 -11
  31. package/dist-client/pages/approval-line/common-approval-line-templates-page.js.map +1 -1
  32. package/dist-client/pages/approval-line/my-approval-line-templates-page.d.ts +0 -2
  33. package/dist-client/pages/approval-line/my-approval-line-templates-page.js +33 -9
  34. package/dist-client/pages/approval-line/my-approval-line-templates-page.js.map +1 -1
  35. package/dist-client/pages/department/department-list-page.d.ts +0 -2
  36. package/dist-client/pages/department/department-list-page.js +2 -6
  37. package/dist-client/pages/department/department-list-page.js.map +1 -1
  38. package/dist-client/pages/department/department-tree-page.d.ts +0 -10
  39. package/dist-client/pages/department/department-tree-page.js +35 -16
  40. package/dist-client/pages/department/department-tree-page.js.map +1 -1
  41. package/dist-client/pages/employee/employee-list-page.d.ts +0 -2
  42. package/dist-client/pages/employee/employee-list-page.js +2 -6
  43. package/dist-client/pages/employee/employee-list-page.js.map +1 -1
  44. package/dist-client/route.d.ts +1 -1
  45. package/dist-client/route.js +9 -0
  46. package/dist-client/route.js.map +1 -1
  47. package/dist-client/tsconfig.tsbuildinfo +1 -1
  48. package/dist-client/types/approval-line.d.ts +64 -0
  49. package/dist-client/types/approval-line.js +67 -0
  50. package/dist-client/types/approval-line.js.map +1 -1
  51. package/dist-server/service/approval-line/approval-line-item.d.ts +40 -0
  52. package/dist-server/service/approval-line/approval-line-item.js +42 -2
  53. package/dist-server/service/approval-line/approval-line-item.js.map +1 -1
  54. package/dist-server/service/approval-line/approval-line-mutation.js +24 -33
  55. package/dist-server/service/approval-line/approval-line-mutation.js.map +1 -1
  56. package/dist-server/service/approval-line/approval-line-query.js +36 -21
  57. package/dist-server/service/approval-line/approval-line-query.js.map +1 -1
  58. package/dist-server/service/employee/employee-query.d.ts +25 -0
  59. package/dist-server/service/employee/employee-query.js +41 -0
  60. package/dist-server/service/employee/employee-query.js.map +1 -1
  61. package/dist-server/service/employee/index.d.ts +1 -0
  62. package/dist-server/service/employee/index.js +3 -0
  63. package/dist-server/service/employee/index.js.map +1 -1
  64. package/dist-server/service/employee/my-employee-refusal.d.ts +22 -0
  65. package/dist-server/service/employee/my-employee-refusal.js +56 -0
  66. package/dist-server/service/employee/my-employee-refusal.js.map +1 -0
  67. package/dist-server/service/employee/my-employee.d.ts +22 -0
  68. package/dist-server/service/employee/my-employee.js +43 -0
  69. package/dist-server/service/employee/my-employee.js.map +1 -0
  70. package/dist-server/tsconfig.tsbuildinfo +1 -1
  71. package/package.json +6 -6
  72. package/spec/unit/my-employee.spec.ts +102 -0
  73. package/things-factory.config.js +1 -0
  74. package/translations/en.json +44 -17
  75. package/translations/ja.json +44 -17
  76. package/translations/ko.json +46 -19
  77. package/translations/ms.json +43 -16
  78. package/translations/zh.json +43 -16
@@ -6,10 +6,74 @@ export declare enum ApprovalLineOwnerType {
6
6
  Employee = "Employee",
7
7
  Common = "Common"
8
8
  }
9
+ /**
10
+ * 결재선에 어떤 자격으로 서는가.
11
+ *
12
+ * 서버는 소문자를 쓴다(`approval-line-item.ts` 의 `ApprovalParticipation`).
13
+ */
14
+ export declare enum ApprovalParticipation {
15
+ /** 결정한다. 이 사람이 승인하거나 반려해야 다음으로 넘어간다. */
16
+ Approval = "approval",
17
+ /** 알기만 한다. 의견은 낼 수 있고 안 내도 되며, 결재를 막지 않는다. */
18
+ Reference = "reference"
19
+ }
20
+ /**
21
+ * Is this step a reference rather than an approval?
22
+ *
23
+ * Ask it here, never inline. "This is an approval" is written two ways on stored rows — `'approval'`
24
+ * on recent ones and nothing at all on rows created before the column existed (5 of the 8 in 내
25
+ * 결재함 today). Both are approvals, and asking in the negative is what makes them behave alike.
26
+ *
27
+ * The danger is the opposite question. `participation === 'approval'` looks equivalent and drops
28
+ * every older row — no error, just a list that is quietly shorter. Four places in this package had
29
+ * each written the check by hand, three of them against the raw string rather than the enum, so a
30
+ * single one of them turning the question around would have gone unnoticed.
31
+ *
32
+ * The server settled this the same way and says why in
33
+ * worklist/server/controllers/activity-approval/approval-line.ts: one place to decide, or the rule
34
+ * grows a second copy that nobody updates.
35
+ */
36
+ export declare function isReferenceStep(item?: {
37
+ participation?: ApprovalParticipation | string | null;
38
+ }): boolean;
39
+ /**
40
+ * The spelling this step should be stored and edited under.
41
+ *
42
+ * isReferenceStep answers the question; this answers with a value, for the places that cannot ask a
43
+ * function. A `<select>` matches its options by string equality, so an option list of `''` and
44
+ * `'reference'` silently selects neither when the API hands back `Reference` — the row then reads
45
+ * as an approver, and the next edit to that row writes the approver spelling back. A reference step
46
+ * turns into an approval with no error and nothing on screen to notice.
47
+ *
48
+ * Approval canonicalises to undefined rather than `'approval'`: rows created before the column
49
+ * existed have nothing there, and empty has to keep meaning approval for those to behave. See
50
+ * ApprovalLineItem.participation.
51
+ */
52
+ export declare function storedParticipation(item?: {
53
+ participation?: ApprovalParticipation | string | null;
54
+ }): ApprovalParticipation | undefined;
55
+ /** Is this step one that has to approve before the request moves on? See isReferenceStep. */
56
+ export declare function isApprovalStep(item?: {
57
+ participation?: ApprovalParticipation | string | null;
58
+ }): boolean;
9
59
  export declare class ApprovalLineItem {
10
60
  type?: OrgMemberTargetType;
11
61
  value?: string;
12
62
  approver?: OrgMemberTarget;
63
+ /**
64
+ * **비어 있으면 결재다.**
65
+ *
66
+ * 지금 도는 결재선에는 이 칸이 없다. 그 항목들이 전부 결재자로 읽혀야 거동이 안 바뀐다.
67
+ */
68
+ participation?: ApprovalParticipation;
69
+ /**
70
+ * 참조에게 언제 알리나 — 몇 번째 결재가 끝났을 때. 비면 상신 즉시.
71
+ *
72
+ * 배열 자리로 시점을 표현하지 않는다. 참조 항목의 자리는 뜻이 없고 결재 차례를 소비하지 않는다.
73
+ * 편집기가 항목을 목록 끝에 붙이므로, 자리로 하면 기본값이 「마지막 결재 뒤」가 되어 의견 낼 기회가
74
+ * 아예 없는 쪽이 기본이 된다.
75
+ */
76
+ notifyAfter?: number;
13
77
  }
14
78
  export declare class ApprovalLine {
15
79
  readonly id?: string;
@@ -3,6 +3,73 @@ export var ApprovalLineOwnerType;
3
3
  ApprovalLineOwnerType["Employee"] = "Employee";
4
4
  ApprovalLineOwnerType["Common"] = "Common";
5
5
  })(ApprovalLineOwnerType || (ApprovalLineOwnerType = {}));
6
+ /**
7
+ * 결재선에 어떤 자격으로 서는가.
8
+ *
9
+ * 서버는 소문자를 쓴다(`approval-line-item.ts` 의 `ApprovalParticipation`).
10
+ */
11
+ export var ApprovalParticipation;
12
+ (function (ApprovalParticipation) {
13
+ /** 결정한다. 이 사람이 승인하거나 반려해야 다음으로 넘어간다. */
14
+ ApprovalParticipation["Approval"] = "approval";
15
+ /** 알기만 한다. 의견은 낼 수 있고 안 내도 되며, 결재를 막지 않는다. */
16
+ ApprovalParticipation["Reference"] = "reference";
17
+ })(ApprovalParticipation || (ApprovalParticipation = {}));
18
+ /**
19
+ * Is this step a reference rather than an approval?
20
+ *
21
+ * Ask it here, never inline. "This is an approval" is written two ways on stored rows — `'approval'`
22
+ * on recent ones and nothing at all on rows created before the column existed (5 of the 8 in 내
23
+ * 결재함 today). Both are approvals, and asking in the negative is what makes them behave alike.
24
+ *
25
+ * The danger is the opposite question. `participation === 'approval'` looks equivalent and drops
26
+ * every older row — no error, just a list that is quietly shorter. Four places in this package had
27
+ * each written the check by hand, three of them against the raw string rather than the enum, so a
28
+ * single one of them turning the question around would have gone unnoticed.
29
+ *
30
+ * The server settled this the same way and says why in
31
+ * worklist/server/controllers/activity-approval/approval-line.ts: one place to decide, or the rule
32
+ * grows a second copy that nobody updates.
33
+ */
34
+ export function isReferenceStep(item) {
35
+ const value = item?.participation;
36
+ /*
37
+ * The same fact arrives spelled two ways, and neither side is wrong.
38
+ *
39
+ * The column holds `reference`, and everything server-side compares against that. GraphQL does
40
+ * not: type-graphql's registerEnumType exposes an enum by its **key**, so the API answers
41
+ * `Reference`. A screen reading `approvalLines { model { participation } }` therefore receives
42
+ * `Reference` and was comparing it to `reference` — false every time.
43
+ *
44
+ * That is why 「표준 3단 결재」 showed its reference step as an approver: no 참조 marker on the
45
+ * list, no quiet styling, and 알림 시점 left editable on a row that is not a reference at all.
46
+ * Four hand-written copies of this check hid it; one place to ask makes it a one-line fix.
47
+ *
48
+ * Both spellings are accepted here, at the boundary, rather than by teaching every caller about
49
+ * the API's casing.
50
+ */
51
+ return typeof value === 'string' && value.toLowerCase() === ApprovalParticipation.Reference;
52
+ }
53
+ /**
54
+ * The spelling this step should be stored and edited under.
55
+ *
56
+ * isReferenceStep answers the question; this answers with a value, for the places that cannot ask a
57
+ * function. A `<select>` matches its options by string equality, so an option list of `''` and
58
+ * `'reference'` silently selects neither when the API hands back `Reference` — the row then reads
59
+ * as an approver, and the next edit to that row writes the approver spelling back. A reference step
60
+ * turns into an approval with no error and nothing on screen to notice.
61
+ *
62
+ * Approval canonicalises to undefined rather than `'approval'`: rows created before the column
63
+ * existed have nothing there, and empty has to keep meaning approval for those to behave. See
64
+ * ApprovalLineItem.participation.
65
+ */
66
+ export function storedParticipation(item) {
67
+ return isReferenceStep(item) ? ApprovalParticipation.Reference : undefined;
68
+ }
69
+ /** Is this step one that has to approve before the request moves on? See isReferenceStep. */
70
+ export function isApprovalStep(item) {
71
+ return !!item && !isReferenceStep(item);
72
+ }
6
73
  export class ApprovalLineItem {
7
74
  }
8
75
  export class ApprovalLine {
@@ -1 +1 @@
1
- {"version":3,"file":"approval-line.js","sourceRoot":"","sources":["../../client/types/approval-line.ts"],"names":[],"mappings":"AAMA,MAAM,CAAN,IAAY,qBAGX;AAHD,WAAY,qBAAqB;IAC/B,8CAAqB,CAAA;IACrB,0CAAiB,CAAA;AACnB,CAAC,EAHW,qBAAqB,KAArB,qBAAqB,QAGhC;AAED,MAAM,OAAO,gBAAgB;CAI5B;AAED,MAAM,OAAO,YAAY;CAkCxB","sourcesContent":["import { Domain, User, Role } from '@operato/shell'\n\nimport { Employee } from './employee'\nimport { Department } from './department'\nimport { OrgMemberTarget, OrgMemberTargetType } from './org-member'\n\nexport enum ApprovalLineOwnerType {\n Employee = 'Employee',\n Common = 'Common'\n}\n\nexport class ApprovalLineItem {\n type?: OrgMemberTargetType\n value?: string\n approver?: OrgMemberTarget\n}\n\nexport class ApprovalLine {\n readonly id?: string\n\n domain?: Domain\n\n domainId?: string\n\n name?: string\n\n description?: string\n\n model?: ApprovalLineItem[]\n\n ownerType?: ApprovalLineOwnerType\n\n ownerValue?: string\n\n ownerEmployee?: Employee\n\n ownerDepartment?: Department\n\n ownerRole?: Role\n\n createdAt?: Date\n\n updatedAt?: Date\n\n creator?: User\n\n creatorId?: string\n\n updater?: User\n\n updaterId?: string\n}\n"]}
1
+ {"version":3,"file":"approval-line.js","sourceRoot":"","sources":["../../client/types/approval-line.ts"],"names":[],"mappings":"AAMA,MAAM,CAAN,IAAY,qBAGX;AAHD,WAAY,qBAAqB;IAC/B,8CAAqB,CAAA;IACrB,0CAAiB,CAAA;AACnB,CAAC,EAHW,qBAAqB,KAArB,qBAAqB,QAGhC;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAY,qBAKX;AALD,WAAY,qBAAqB;IAC/B,wCAAwC;IACxC,8CAAqB,CAAA;IACrB,8CAA8C;IAC9C,gDAAuB,CAAA;AACzB,CAAC,EALW,qBAAqB,KAArB,qBAAqB,QAKhC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,eAAe,CAAC,IAAgE;IAC9F,MAAM,KAAK,GAAG,IAAI,EAAE,aAAa,CAAA;IAEjC;;;;;;;;;;;;;;OAcG;IACH,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,WAAW,EAAE,KAAK,qBAAqB,CAAC,SAAS,CAAA;AAC7F,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAEnC;IACC,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,qBAAqB,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAA;AAC5E,CAAC;AAED,6FAA6F;AAC7F,MAAM,UAAU,cAAc,CAAC,IAAgE;IAC7F,OAAO,CAAC,CAAC,IAAI,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAA;AACzC,CAAC;AAED,MAAM,OAAO,gBAAgB;CAoB5B;AAED,MAAM,OAAO,YAAY;CAkCxB","sourcesContent":["import { Domain, User, Role } from '@operato/shell'\n\nimport { Employee } from './employee'\nimport { Department } from './department'\nimport { OrgMemberTarget, OrgMemberTargetType } from './org-member'\n\nexport enum ApprovalLineOwnerType {\n Employee = 'Employee',\n Common = 'Common'\n}\n\n/**\n * 결재선에 어떤 자격으로 서는가.\n *\n * 서버는 소문자를 쓴다(`approval-line-item.ts` 의 `ApprovalParticipation`).\n */\nexport enum ApprovalParticipation {\n /** 결정한다. 이 사람이 승인하거나 반려해야 다음으로 넘어간다. */\n Approval = 'approval',\n /** 알기만 한다. 의견은 낼 수 있고 안 내도 되며, 결재를 막지 않는다. */\n Reference = 'reference'\n}\n\n/**\n * Is this step a reference rather than an approval?\n *\n * Ask it here, never inline. \"This is an approval\" is written two ways on stored rows — `'approval'`\n * on recent ones and nothing at all on rows created before the column existed (5 of the 8 in 내\n * 결재함 today). Both are approvals, and asking in the negative is what makes them behave alike.\n *\n * The danger is the opposite question. `participation === 'approval'` looks equivalent and drops\n * every older row — no error, just a list that is quietly shorter. Four places in this package had\n * each written the check by hand, three of them against the raw string rather than the enum, so a\n * single one of them turning the question around would have gone unnoticed.\n *\n * The server settled this the same way and says why in\n * worklist/server/controllers/activity-approval/approval-line.ts: one place to decide, or the rule\n * grows a second copy that nobody updates.\n */\nexport function isReferenceStep(item?: { participation?: ApprovalParticipation | string | null }): boolean {\n const value = item?.participation\n\n /*\n * The same fact arrives spelled two ways, and neither side is wrong.\n *\n * The column holds `reference`, and everything server-side compares against that. GraphQL does\n * not: type-graphql's registerEnumType exposes an enum by its **key**, so the API answers\n * `Reference`. A screen reading `approvalLines { model { participation } }` therefore receives\n * `Reference` and was comparing it to `reference` — false every time.\n *\n * That is why 「표준 3단 결재」 showed its reference step as an approver: no 참조 marker on the\n * list, no quiet styling, and 알림 시점 left editable on a row that is not a reference at all.\n * Four hand-written copies of this check hid it; one place to ask makes it a one-line fix.\n *\n * Both spellings are accepted here, at the boundary, rather than by teaching every caller about\n * the API's casing.\n */\n return typeof value === 'string' && value.toLowerCase() === ApprovalParticipation.Reference\n}\n\n/**\n * The spelling this step should be stored and edited under.\n *\n * isReferenceStep answers the question; this answers with a value, for the places that cannot ask a\n * function. A `<select>` matches its options by string equality, so an option list of `''` and\n * `'reference'` silently selects neither when the API hands back `Reference` — the row then reads\n * as an approver, and the next edit to that row writes the approver spelling back. A reference step\n * turns into an approval with no error and nothing on screen to notice.\n *\n * Approval canonicalises to undefined rather than `'approval'`: rows created before the column\n * existed have nothing there, and empty has to keep meaning approval for those to behave. See\n * ApprovalLineItem.participation.\n */\nexport function storedParticipation(item?: {\n participation?: ApprovalParticipation | string | null\n}): ApprovalParticipation | undefined {\n return isReferenceStep(item) ? ApprovalParticipation.Reference : undefined\n}\n\n/** Is this step one that has to approve before the request moves on? See isReferenceStep. */\nexport function isApprovalStep(item?: { participation?: ApprovalParticipation | string | null }): boolean {\n return !!item && !isReferenceStep(item)\n}\n\nexport class ApprovalLineItem {\n type?: OrgMemberTargetType\n value?: string\n approver?: OrgMemberTarget\n\n /**\n * **비어 있으면 결재다.**\n *\n * 지금 도는 결재선에는 이 칸이 없다. 그 항목들이 전부 결재자로 읽혀야 거동이 안 바뀐다.\n */\n participation?: ApprovalParticipation\n\n /**\n * 참조에게 언제 알리나 — 몇 번째 결재가 끝났을 때. 비면 상신 즉시.\n *\n * 배열 자리로 시점을 표현하지 않는다. 참조 항목의 자리는 뜻이 없고 결재 차례를 소비하지 않는다.\n * 편집기가 항목을 목록 끝에 붙이므로, 자리로 하면 기본값이 「마지막 결재 뒤」가 되어 의견 낼 기회가\n * 아예 없는 쪽이 기본이 된다.\n */\n notifyAfter?: number\n}\n\nexport class ApprovalLine {\n readonly id?: string\n\n domain?: Domain\n\n domainId?: string\n\n name?: string\n\n description?: string\n\n model?: ApprovalLineItem[]\n\n ownerType?: ApprovalLineOwnerType\n\n ownerValue?: string\n\n ownerEmployee?: Employee\n\n ownerDepartment?: Department\n\n ownerRole?: Role\n\n createdAt?: Date\n\n updatedAt?: Date\n\n creator?: User\n\n creatorId?: string\n\n updater?: User\n\n updaterId?: string\n}\n"]}
@@ -12,8 +12,48 @@ export declare class OrgMemberTarget {
12
12
  description?: string;
13
13
  controlNo?: string;
14
14
  }
15
+ /**
16
+ * 이 사람이 **무슨 자격으로** 결재선에 서나 — 누구인가(`type`)와 다른 축이다.
17
+ *
18
+ * ── 왜 필요한가 (2026-09-01) ─────────────────────────────────────────────
19
+ * 결재선에 설 수 있는 자격이 「결재」뿐이었다. 그래서 **의견만 내고 결재는 안 하는 자리가 없다.**
20
+ * 품질팀장이 「이 특채는 도금 이력을 봐야 한다」고 말하려면 승인 권한을 줘야 했고, 권한을 주면 그
21
+ * 사람이 결재자가 된다.
22
+ *
23
+ * ── 참조는 막지 않는다 ───────────────────────────────────────────────────
24
+ * 참조자가 아직 안 읽었어도 결재는 다음으로 넘어간다. 막게 만들면 그 사람이 휴가일 때 결재가 선다.
25
+ *
26
+ * 막아야 하는 자격(합의)은 아직 넣지 않았다 . 요청하는 곳이 없다. 값만 선언하면 화면에 뜨는데 안 도는
27
+ * 항목이 된다.
28
+ */
29
+ export declare enum ApprovalParticipation {
30
+ /** 승인·반려한다. 이 사람이 결정하기 전에는 다음으로 안 넘어간다. */
31
+ Approval = "approval",
32
+ /** 의견만 낸다. 판정에 영향이 없고, 말하지 않아도 진행된다. */
33
+ Reference = "reference"
34
+ }
15
35
  export declare class ApprovalLineItem {
16
36
  type?: OrgMemberTargetType;
17
37
  value?: string;
18
38
  approver?: OrgMemberTarget;
39
+ /**
40
+ * **비어 있으면 「결재」다.**
41
+ *
42
+ * 지금 도는 결재선은 이 칸이 없다(gangsters·dataset·quotation·accounting). 그 항목들이 전부
43
+ * 결재자로 읽혀야 거동이 안 바뀐다.
44
+ */
45
+ participation?: ApprovalParticipation;
46
+ /**
47
+ * **참조에게 언제 알리나** — 몇 번째 결재가 끝났을 때. 없으면 상신 즉시.
48
+ *
49
+ * ── 왜 배열 자리로 하지 않았나 ─────────────────────────────────────────
50
+ * 참조를 쓰는 사람은 대개 시점에 관심이 없다 — 「품질팀장도 알고 있어야 한다」가 전부다. 자리로
51
+ * 표현하면 아무 데나 넣은 값이 기록에는 의도한 것처럼 남는다. 그리고 편집기가 항목을 목록 **끝**에
52
+ * 붙이므로, 기본값이 「마지막 결재 뒤에 알림」이 된다 — 의견 낼 기회가 아예 없는 쪽이 기본이 된다.
53
+ *
54
+ * 그래서 값으로 둔다. 없으면 상신 즉시 — 가장 일찍 알리는 쪽이 안 정한 사람에게 안전하다.
55
+ *
56
+ * **참조 항목의 배열 자리는 뜻이 없다.** 결재 차례를 소비하지 않는다.
57
+ */
58
+ notifyAfter?: number;
19
59
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ApprovalLineItem = exports.OrgMemberTarget = exports.OrgMemberTargetType = void 0;
3
+ exports.ApprovalLineItem = exports.ApprovalParticipation = exports.OrgMemberTarget = exports.OrgMemberTargetType = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const type_graphql_1 = require("type-graphql");
6
6
  var OrgMemberTargetType;
@@ -38,6 +38,31 @@ tslib_1.__decorate([
38
38
  exports.OrgMemberTarget = OrgMemberTarget = tslib_1.__decorate([
39
39
  (0, type_graphql_1.ObjectType)()
40
40
  ], OrgMemberTarget);
41
+ /**
42
+ * 이 사람이 **무슨 자격으로** 결재선에 서나 — 누구인가(`type`)와 다른 축이다.
43
+ *
44
+ * ── 왜 필요한가 (2026-09-01) ─────────────────────────────────────────────
45
+ * 결재선에 설 수 있는 자격이 「결재」뿐이었다. 그래서 **의견만 내고 결재는 안 하는 자리가 없다.**
46
+ * 품질팀장이 「이 특채는 도금 이력을 봐야 한다」고 말하려면 승인 권한을 줘야 했고, 권한을 주면 그
47
+ * 사람이 결재자가 된다.
48
+ *
49
+ * ── 참조는 막지 않는다 ───────────────────────────────────────────────────
50
+ * 참조자가 아직 안 읽었어도 결재는 다음으로 넘어간다. 막게 만들면 그 사람이 휴가일 때 결재가 선다.
51
+ *
52
+ * 막아야 하는 자격(합의)은 아직 넣지 않았다 . 요청하는 곳이 없다. 값만 선언하면 화면에 뜨는데 안 도는
53
+ * 항목이 된다.
54
+ */
55
+ var ApprovalParticipation;
56
+ (function (ApprovalParticipation) {
57
+ /** 승인·반려한다. 이 사람이 결정하기 전에는 다음으로 안 넘어간다. */
58
+ ApprovalParticipation["Approval"] = "approval";
59
+ /** 의견만 낸다. 판정에 영향이 없고, 말하지 않아도 진행된다. */
60
+ ApprovalParticipation["Reference"] = "reference";
61
+ })(ApprovalParticipation || (exports.ApprovalParticipation = ApprovalParticipation = {}));
62
+ (0, type_graphql_1.registerEnumType)(ApprovalParticipation, {
63
+ name: 'ApprovalParticipation',
64
+ description: 'in what capacity this member joins the approval line: approval decides, reference only comments'
65
+ });
41
66
  let ApprovalLineItem = class ApprovalLineItem {
42
67
  };
43
68
  exports.ApprovalLineItem = ApprovalLineItem;
@@ -51,8 +76,23 @@ tslib_1.__decorate([
51
76
  ], ApprovalLineItem.prototype, "value", void 0);
52
77
  tslib_1.__decorate([
53
78
  (0, type_graphql_1.Field)(type => OrgMemberTarget, { nullable: true }),
54
- tslib_1.__metadata("design:type", OrgMemberTarget)
79
+ tslib_1.__metadata("design:type", OrgMemberTarget
80
+ /**
81
+ * **비어 있으면 「결재」다.**
82
+ *
83
+ * 지금 도는 결재선은 이 칸이 없다(gangsters·dataset·quotation·accounting). 그 항목들이 전부
84
+ * 결재자로 읽혀야 거동이 안 바뀐다.
85
+ */
86
+ )
55
87
  ], ApprovalLineItem.prototype, "approver", void 0);
88
+ tslib_1.__decorate([
89
+ (0, type_graphql_1.Field)(type => ApprovalParticipation, { nullable: true }),
90
+ tslib_1.__metadata("design:type", String)
91
+ ], ApprovalLineItem.prototype, "participation", void 0);
92
+ tslib_1.__decorate([
93
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true }),
94
+ tslib_1.__metadata("design:type", Number)
95
+ ], ApprovalLineItem.prototype, "notifyAfter", void 0);
56
96
  exports.ApprovalLineItem = ApprovalLineItem = tslib_1.__decorate([
57
97
  (0, type_graphql_1.ObjectType)({ description: 'Entity for approval line item' })
58
98
  ], ApprovalLineItem);
@@ -1 +1 @@
1
- {"version":3,"file":"approval-line-item.js","sourceRoot":"","sources":["../../../server/service/approval-line/approval-line-item.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AAEtE,IAAY,mBAOX;AAPD,WAAY,mBAAmB;IAC7B,4CAAqB,CAAA;IACrB,gDAAyB,CAAA;IACzB,oCAAa,CAAA;IACb,wCAAiB,CAAA;IACjB,oDAA6B,CAAA;IAC7B,oDAA6B,CAAA;AAC/B,CAAC,EAPW,mBAAmB,mCAAnB,mBAAmB,QAO9B;AAED,IAAA,+BAAgB,EAAC,mBAAmB,EAAE;IACpC,IAAI,EAAE,qBAAqB;IAC3B,WAAW,EAAE,0CAA0C;CACxD,CAAC,CAAA;AAGK,IAAM,eAAe,GAArB,MAAM,eAAe;CAY3B,CAAA;AAZY,0CAAe;AAE1B;IADC,IAAA,oBAAK,EAAC,GAAG,EAAE,CAAC,iBAAE,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC;;2CAClC;AAGX;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,YAAY,EAAE,CAAC;;6CACxC;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,mBAAmB,EAAE,CAAC;;oDACxC;AAGpB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kDACR;0BAXP,eAAe;IAD3B,IAAA,yBAAU,GAAE;GACA,eAAe,CAY3B;AAGM,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CAS5B,CAAA;AATY,4CAAgB;AAE3B;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACA;AAG1B;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CAC5B;AAGd;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,eAAe,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACxC,eAAe;kDAAA;2BARf,gBAAgB;IAD5B,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,+BAA+B,EAAE,CAAC;GAChD,gBAAgB,CAS5B","sourcesContent":["import { ObjectType, Field, ID, registerEnumType } from 'type-graphql'\n\nexport enum OrgMemberTargetType {\n Employee = 'Employee',\n Department = 'Department',\n Role = 'Role',\n Myself = 'Myself',\n MyDepartment = 'MyDepartment',\n MySupervisor = 'MySupervisor'\n}\n\nregisterEnumType(OrgMemberTargetType, {\n name: 'OrgMemberTargetType',\n description: 'type enumeration of a approval line item'\n})\n\n@ObjectType()\nexport class OrgMemberTarget {\n @Field(() => ID, { description: 'Field id' })\n id?: string\n\n @Field({ nullable: true, description: 'Field name' })\n name?: string\n\n @Field({ nullable: true, description: 'Field description' })\n description?: string\n\n @Field({ nullable: true })\n controlNo?: string\n}\n\n@ObjectType({ description: 'Entity for approval line item' })\nexport class ApprovalLineItem {\n @Field({ nullable: true })\n type?: OrgMemberTargetType\n\n @Field(type => String, { nullable: true })\n value?: string\n\n @Field(type => OrgMemberTarget, { nullable: true })\n approver?: OrgMemberTarget\n}\n"]}
1
+ {"version":3,"file":"approval-line-item.js","sourceRoot":"","sources":["../../../server/service/approval-line/approval-line-item.ts"],"names":[],"mappings":";;;;AAAA,+CAA2E;AAE3E,IAAY,mBAOX;AAPD,WAAY,mBAAmB;IAC7B,4CAAqB,CAAA;IACrB,gDAAyB,CAAA;IACzB,oCAAa,CAAA;IACb,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AAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CAC5B;AAGd;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,eAAe,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACxC,eAAe;IAE1B;;;;;OAKG;;kDAPuB;AAS1B;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,qBAAqB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;uDACpB;AAerC;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qDACnB;2BAhCT,gBAAgB;IAD5B,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,+BAA+B,EAAE,CAAC;GAChD,gBAAgB,CAiC5B","sourcesContent":["import { ObjectType, Field, ID, Int, registerEnumType } from 'type-graphql'\n\nexport enum OrgMemberTargetType {\n Employee = 'Employee',\n Department = 'Department',\n Role = 'Role',\n Myself = 'Myself',\n MyDepartment = 'MyDepartment',\n MySupervisor = 'MySupervisor'\n}\n\nregisterEnumType(OrgMemberTargetType, {\n name: 'OrgMemberTargetType',\n description: 'type enumeration of a approval line item'\n})\n\n@ObjectType()\nexport class OrgMemberTarget {\n @Field(() => ID, { description: 'Field id' })\n id?: string\n\n @Field({ nullable: true, description: 'Field name' })\n name?: string\n\n @Field({ nullable: true, description: 'Field description' })\n description?: string\n\n @Field({ nullable: true })\n controlNo?: string\n}\n\n/**\n * 이 사람이 **무슨 자격으로** 결재선에 서나 — 누구인가(`type`)와 다른 축이다.\n *\n * ── 왜 필요한가 (2026-09-01) ─────────────────────────────────────────────\n * 결재선에 설 수 있는 자격이 「결재」뿐이었다. 그래서 **의견만 내고 결재는 안 하는 자리가 없다.**\n * 품질팀장이 「이 특채는 도금 이력을 봐야 한다」고 말하려면 승인 권한을 줘야 했고, 권한을 주면 그\n * 사람이 결재자가 된다.\n *\n * ── 참조는 막지 않는다 ───────────────────────────────────────────────────\n * 참조자가 아직 안 읽었어도 결재는 다음으로 넘어간다. 막게 만들면 그 사람이 휴가일 때 결재가 선다.\n *\n * 막아야 하는 자격(합의)은 아직 넣지 않았다 . 요청하는 곳이 없다. 값만 선언하면 화면에 뜨는데 안 도는\n * 항목이 된다.\n */\nexport enum ApprovalParticipation {\n /** 승인·반려한다. 이 사람이 결정하기 전에는 다음으로 안 넘어간다. */\n Approval = 'approval',\n /** 의견만 낸다. 판정에 영향이 없고, 말하지 않아도 진행된다. */\n Reference = 'reference'\n}\n\nregisterEnumType(ApprovalParticipation, {\n name: 'ApprovalParticipation',\n description: 'in what capacity this member joins the approval line: approval decides, reference only comments'\n})\n\n@ObjectType({ description: 'Entity for approval line item' })\nexport class ApprovalLineItem {\n @Field({ nullable: true })\n type?: OrgMemberTargetType\n\n @Field(type => String, { nullable: true })\n value?: string\n\n @Field(type => OrgMemberTarget, { nullable: true })\n approver?: OrgMemberTarget\n\n /**\n * **비어 있으면 「결재」다.**\n *\n * 지금 도는 결재선은 이 칸이 없다(gangsters·dataset·quotation·accounting). 그 항목들이 전부\n * 결재자로 읽혀야 거동이 안 바뀐다.\n */\n @Field(type => ApprovalParticipation, { nullable: true })\n participation?: ApprovalParticipation\n\n /**\n * **참조에게 언제 알리나** — 몇 번째 결재가 끝났을 때. 없으면 상신 즉시.\n *\n * ── 왜 배열 자리로 하지 않았나 ─────────────────────────────────────────\n * 참조를 쓰는 사람은 대개 시점에 관심이 없다 — 「품질팀장도 알고 있어야 한다」가 전부다. 자리로\n * 표현하면 아무 데나 넣은 값이 기록에는 의도한 것처럼 남는다. 그리고 편집기가 항목을 목록 **끝**에\n * 붙이므로, 기본값이 「마지막 결재 뒤에 알림」이 된다 — 의견 낼 기회가 아예 없는 쪽이 기본이 된다.\n *\n * 그래서 값으로 둔다. 없으면 상신 즉시 — 가장 일찍 알리는 쪽이 안 정한 사람에게 안전하다.\n *\n * **참조 항목의 배열 자리는 뜻이 없다.** 결재 차례를 소비하지 않는다.\n */\n @Field(type => Int, { nullable: true })\n notifyAfter?: number\n}\n"]}
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ApprovalLineMutation = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const type_graphql_1 = require("type-graphql");
6
+ const my_employee_js_1 = require("../employee/my-employee.js");
6
7
  const typeorm_1 = require("typeorm");
7
8
  const shell_1 = require("@things-factory/shell");
8
9
  const employee_1 = require("../employee/employee");
@@ -41,9 +42,21 @@ function getModelValue(patch) {
41
42
  }
42
43
  return model
43
44
  .map(m => {
45
+ /*
46
+ * ── 칸을 하나씩 옮겨 적는 자리다. 새 칸을 여기 안 적으면 조용히 사라진다 ──────────
47
+ * `participation` 과 `notifyAfter` 가 이 목록에 없어서, 편집기에서 「참조」로 고쳐도 저장되지
48
+ * 않았다. 오류도 나지 않는다 — 화면에서는 고쳐지고, 다시 읽으면 결재자로 돌아온다.
49
+ *
50
+ * 두 칸은 `ApprovalLineItem` 에 선언되어 있다(`approval-line-item.ts`). 선언은 있고 쓰는 길이
51
+ * 없던 것이다.
52
+ *
53
+ * `ApprovalLineItem` 에 칸을 더하면 **여기도 함께 고쳐야 한다.**
54
+ */
44
55
  return {
45
56
  type: m.type,
46
- approver: m.approver
57
+ approver: m.approver,
58
+ participation: m.participation,
59
+ notifyAfter: m.notifyAfter
47
60
  };
48
61
  })
49
62
  .filter(m => m.type)
@@ -73,13 +86,7 @@ let ApprovalLineMutation = class ApprovalLineMutation {
73
86
  }
74
87
  async createMyApprovalLine(approvalLine, context) {
75
88
  const { domain, user, tx } = context.state;
76
- const employee = await (0, shell_1.getRepository)(employee_1.Employee, tx).findOneBy({
77
- domain: { id: domain.id },
78
- user: { id: user.id }
79
- });
80
- if (!employee) {
81
- throw new Error('There is no employee object associated with the user.');
82
- }
89
+ const employee = await (0, my_employee_js_1.requireMyEmployee)(context);
83
90
  const result = await (0, shell_1.getRepository)(approval_line_1.ApprovalLine, tx).save({
84
91
  ...approvalLine,
85
92
  ownerType: approval_line_1.ApprovalLineOwnerType.Employee,
@@ -108,10 +115,12 @@ let ApprovalLineMutation = class ApprovalLineMutation {
108
115
  }
109
116
  async updateMyApprovalLine(id, patch, context) {
110
117
  const { domain, user, tx } = context.state;
111
- const employee = await (0, shell_1.getRepository)(employee_1.Employee, tx).findOneBy({
112
- domain: { id: domain.id },
113
- user: { id: user.id }
114
- });
118
+ /*
119
+ * **검사가 여기 없었다.** 사원 기록이 없으면 아래 `employee.id` 에서 null 참조로 터졌고, 그
120
+ * 문장은 옆의 넷이 던지던 것보다 알아보기 어려웠다. 넷은 검사하고 하나는 안 하는 상태가 더 나쁜
121
+ * 이유는, 고친 사람이 「검사가 있다」고 믿게 되기 때문이다.
122
+ */
123
+ const employee = await (0, my_employee_js_1.requireMyEmployee)(context);
115
124
  const repository = (0, shell_1.getRepository)(approval_line_1.ApprovalLine, tx);
116
125
  const approvalLine = await repository.findOne({
117
126
  where: { domain: { id: domain.id }, id }
@@ -169,13 +178,7 @@ let ApprovalLineMutation = class ApprovalLineMutation {
169
178
  }
170
179
  async updateMultipleMyApprovalLine(patches, context) {
171
180
  const { domain, user, tx } = context.state;
172
- const employee = await (0, shell_1.getRepository)(employee_1.Employee, tx).findOneBy({
173
- domain: { id: domain.id },
174
- user: { id: user.id }
175
- });
176
- if (!employee) {
177
- throw new Error('There is no employee object associated with the user.');
178
- }
181
+ const employee = await (0, my_employee_js_1.requireMyEmployee)(context);
179
182
  let results = [];
180
183
  const _createRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === '+');
181
184
  const _updateRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === 'M');
@@ -232,13 +235,7 @@ let ApprovalLineMutation = class ApprovalLineMutation {
232
235
  }
233
236
  async deleteMyApprovalLine(id, context) {
234
237
  const { domain, user, tx } = context.state;
235
- const employee = await (0, shell_1.getRepository)(employee_1.Employee, tx).findOneBy({
236
- domain: { id: domain.id },
237
- user: { id: user.id }
238
- });
239
- if (!employee) {
240
- throw new Error('There is no employee object associated with the user.');
241
- }
238
+ const employee = await (0, my_employee_js_1.requireMyEmployee)(context);
242
239
  await (0, shell_1.getRepository)(approval_line_1.ApprovalLine, tx).delete({
243
240
  id,
244
241
  domain: { id: domain.id },
@@ -249,13 +246,7 @@ let ApprovalLineMutation = class ApprovalLineMutation {
249
246
  }
250
247
  async deleteMyApprovalLines(ids, context) {
251
248
  const { domain, user, tx } = context.state;
252
- const employee = await (0, shell_1.getRepository)(employee_1.Employee, tx).findOneBy({
253
- domain: { id: domain.id },
254
- user: { id: user.id }
255
- });
256
- if (!employee) {
257
- throw new Error('There is no employee object associated with the user.');
258
- }
249
+ const employee = await (0, my_employee_js_1.requireMyEmployee)(context);
259
250
  await (0, shell_1.getRepository)(approval_line_1.ApprovalLine, tx).delete({
260
251
  domain: { id: domain.id },
261
252
  ownerType: approval_line_1.ApprovalLineOwnerType.Employee,
@@ -1 +1 @@
1
- {"version":3,"file":"approval-line-mutation.js","sourceRoot":"","sources":["../../../server/service/approval-line/approval-line-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,iDAAqD;AACrD,mDAA+C;AAC/C,mDAAqE;AACrE,6DAA4E;AAC5E,6DAAyE;AAEzE,KAAK,UAAU,aAAa,CAC1B,YAAgE,EAChE,KAA0C,EAC1C,OAAwB;IAExB,IAAI,CAAC,CAAC,OAAO,IAAI,KAAK,IAAI,WAAW,IAAI,KAAK,CAAC,EAAE,CAAC;QAChD,mDAAmD;QACnD,OAAM;IACR,CAAC;IAED,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;IACpC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,KAAK,CAAA;IAElC,IAAI,CAAC,SAAS,IAAI,CAAC,KAAK,EAAE,CAAC;QACzB,kDAAkD;QAClD,OAAO,IAAI,CAAA;IACb,CAAC;IAED,IA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BAAG,GAAE,CAAA;;;;+DAcP;+BA3UU,oBAAoB;IADhC,IAAA,uBAAQ,EAAC,4BAAY,CAAC;GACV,oBAAoB,CA4UhC","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { getRepository } from '@things-factory/shell'\nimport { Employee } from '../employee/employee'\nimport { ApprovalLine, ApprovalLineOwnerType } from './approval-line'\nimport { ApprovalLineItem, OrgMemberTargetType } from './approval-line-item'\nimport { NewApprovalLine, ApprovalLinePatch } from './approval-line-type'\n\nasync function getOwnerValue(\n approvalLine: ApprovalLine | NewApprovalLine | ApprovalLinePatch,\n patch: NewApprovalLine | ApprovalLinePatch,\n context: ResolverContext\n) {\n if (!('owner' in patch || 'ownerType' in patch)) {\n /* owner 또는 ownerType 하나도 언급되지 않았다면, 업데이트하지 않는다. */\n return\n }\n\n const { domain, tx } = context.state\n const { ownerType, owner } = patch\n\n if (!ownerType || !owner) {\n /* ownerType이 클리어되거나, owner가 지정되지 않았다면, 클리어시킨다. */\n return null\n }\n\n var ownerObject\n\n switch (ownerType || approvalLine.ownerType) {\n case ApprovalLineOwnerType.Employee:\n ownerObject = await getRepository(Employee, tx).findOneBy({ domain: { id: domain.id }, id: owner.id })\n break\n default:\n }\n\n return ownerObject?.id || null\n}\n\nfunction getModelValue(patch: NewApprovalLine | ApprovalLinePatch): ApprovalLineItem[] {\n if (!('model' in patch)) {\n /* model이 언급되지 않았다면, 업데이트하지 않는다. */\n return\n }\n\n const { model } = patch\n\n if (!model || !(model instanceof Array)) {\n /* model의 값이 없거나 배열이 아니라면, 클리어시킨다. */\n return null\n }\n\n return model\n .map(m => {\n return {\n type: m.type,\n approver: m.approver\n } as ApprovalLineItem\n })\n .filter(m => m.type)\n .filter(m => {\n switch (m.type) {\n case OrgMemberTargetType.Employee:\n case OrgMemberTargetType.Department:\n case OrgMemberTargetType.Role:\n return !!m.approver?.id\n default:\n return true\n }\n })\n}\n\n@Resolver(ApprovalLine)\nexport class ApprovalLineMutation {\n @Directive('@transaction')\n @Directive('@privilege(category: \"organization\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => ApprovalLine, { description: 'To create new ApprovalLine' })\n async createApprovalLine(\n @Arg('approvalLine') approvalLine: NewApprovalLine,\n @Ctx() context: ResolverContext\n ): Promise<ApprovalLine> {\n const { domain, user, tx } = context.state\n\n const result = await getRepository(ApprovalLine, tx).save({\n ...approvalLine,\n ownerValue: await getOwnerValue(approvalLine, approvalLine, context),\n model: getModelValue(approvalLine),\n domain,\n creator: user,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => ApprovalLine, { description: 'To create new ApprovalLine for current user' })\n async createMyApprovalLine(\n @Arg('approvalLine') approvalLine: NewApprovalLine,\n @Ctx() context: ResolverContext\n ): Promise<ApprovalLine> {\n const { domain, user, tx } = context.state\n const employee = await getRepository(Employee, tx).findOneBy({\n domain: { id: domain.id },\n user: { id: user.id }\n })\n\n if (!employee) {\n throw new Error('There is no employee object associated with the user.')\n }\n\n const result = await getRepository(ApprovalLine, tx).save({\n ...approvalLine,\n ownerType: ApprovalLineOwnerType.Employee,\n ownerValue: employee.id,\n model: getModelValue(approvalLine),\n domain,\n creator: user,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"organization\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => ApprovalLine, { description: 'To modify ApprovalLine information' })\n async updateApprovalLine(\n @Arg('id') id: string,\n @Arg('patch') patch: ApprovalLinePatch,\n @Ctx() context: ResolverContext\n ): Promise<ApprovalLine> {\n const { domain, user, tx } = context.state\n\n const repository = getRepository(ApprovalLine, tx)\n const approvalLine = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const result = await repository.save({\n ...approvalLine,\n ...patch,\n ownerValue: await getOwnerValue(approvalLine, patch, context),\n model: getModelValue(patch),\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => ApprovalLine, { description: 'To modify ApprovalLine information for current user' })\n async updateMyApprovalLine(\n @Arg('id') id: string,\n @Arg('patch') patch: ApprovalLinePatch,\n @Ctx() context: ResolverContext\n ): Promise<ApprovalLine> {\n const { domain, user, tx } = context.state\n const employee = await getRepository(Employee, tx).findOneBy({\n domain: { id: domain.id },\n user: { id: user.id }\n })\n\n const repository = getRepository(ApprovalLine, tx)\n const approvalLine = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const result = await repository.save({\n ...approvalLine,\n ...patch,\n ownerType: ApprovalLineOwnerType.Employee,\n ownerValue: employee.id,\n model: getModelValue(patch),\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"organization\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => [ApprovalLine], { description: \"To modify multiple ApprovalLines' information\" })\n async updateMultipleApprovalLine(\n @Arg('patches', type => [ApprovalLinePatch]) patches: ApprovalLinePatch[],\n @Ctx() context: ResolverContext\n ): Promise<ApprovalLine[]> {\n const { domain, user, tx } = context.state\n\n let results = []\n const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')\n const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')\n const approvalLineRepo = getRepository(ApprovalLine, tx)\n\n if (_createRecords.length > 0) {\n for (let i = 0; i < _createRecords.length; i++) {\n const newRecord = _createRecords[i]\n\n const result = await approvalLineRepo.save({\n ...newRecord,\n ownerValue: await getOwnerValue(newRecord, newRecord, context),\n model: getModelValue(newRecord),\n domain,\n creator: user,\n updater: user\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 const approvalLine = await approvalLineRepo.findOne({\n where: { domain: { id: domain.id }, id: updateRecord.id }\n })\n\n if (!approvalLine) {\n throw new Error(`failed to find approvalLine to update: ${updateRecord.id}`)\n }\n\n const result = await approvalLineRepo.save({\n ...approvalLine,\n ...updateRecord,\n ownerValue: await getOwnerValue(approvalLine, updateRecord, context),\n model: getModelValue(updateRecord),\n updater: user\n })\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n }\n\n @Directive('@transaction')\n @Mutation(returns => [ApprovalLine], {\n description: \"To modify multiple ApprovalLines' information for current user\"\n })\n async updateMultipleMyApprovalLine(\n @Arg('patches', type => [ApprovalLinePatch]) patches: ApprovalLinePatch[],\n @Ctx() context: ResolverContext\n ): Promise<ApprovalLine[]> {\n const { domain, user, tx } = context.state\n\n const employee = await getRepository(Employee, tx).findOneBy({\n domain: { id: domain.id },\n user: { id: user.id }\n })\n\n if (!employee) {\n throw new Error('There is no employee object associated with the user.')\n }\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 approvalLineRepo = getRepository(ApprovalLine, tx)\n\n if (_createRecords.length > 0) {\n for (let i = 0; i < _createRecords.length; i++) {\n const newRecord = _createRecords[i]\n\n const result = await approvalLineRepo.save({\n ...newRecord,\n ownerType: ApprovalLineOwnerType.Employee,\n ownerValue: employee.id,\n model: getModelValue(newRecord),\n domain,\n creator: user,\n updater: user\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 const approvalLine = await approvalLineRepo.findOne({\n where: { domain: { id: domain.id }, id: updateRecord.id }\n })\n\n if (!approvalLine) {\n throw new Error(`failed to find approvalLine to update: ${updateRecord.id}`)\n }\n\n const result = await approvalLineRepo.save({\n ...approvalLine,\n ...updateRecord,\n ownerType: ApprovalLineOwnerType.Employee,\n ownerValue: employee.id,\n model: getModelValue(updateRecord),\n updater: user\n })\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"organization\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, { description: 'To delete ApprovalLine' })\n async deleteApprovalLine(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(ApprovalLine, tx).delete({ domain: { id: domain.id }, id })\n\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"organization\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, { description: 'To delete multiple ApprovalLines' })\n async deleteApprovalLines(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(ApprovalLine, tx).delete({\n domain: { id: domain.id },\n id: In(ids)\n })\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete ApprovalLine for current user' })\n async deleteMyApprovalLine(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, user, tx } = context.state\n\n const employee = await getRepository(Employee, tx).findOneBy({\n domain: { id: domain.id },\n user: { id: user.id }\n })\n\n if (!employee) {\n throw new Error('There is no employee object associated with the user.')\n }\n\n await getRepository(ApprovalLine, tx).delete({\n id,\n domain: { id: domain.id },\n ownerType: ApprovalLineOwnerType.Employee,\n ownerValue: employee.id\n })\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple ApprovalLines for current user' })\n async deleteMyApprovalLines(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, user, tx } = context.state\n\n const employee = await getRepository(Employee, tx).findOneBy({\n domain: { id: domain.id },\n user: { id: user.id }\n })\n\n if (!employee) {\n throw new Error('There is no employee object associated with the user.')\n }\n\n await getRepository(ApprovalLine, tx).delete({\n domain: { id: domain.id },\n ownerType: ApprovalLineOwnerType.Employee,\n ownerValue: employee.id,\n id: In(ids)\n })\n\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"organization\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, { description: 'To import multiple ApprovalLines' })\n async importApprovalLines(\n @Arg('approvalLines', type => [ApprovalLinePatch]) approvalLines: ApprovalLinePatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n approvalLines.map(async (approvalLine: ApprovalLinePatch) => {\n const createdApprovalLine: ApprovalLine = await getRepository(ApprovalLine, tx).save({\n domain,\n ...approvalLine\n })\n })\n )\n\n return true\n }\n}\n"]}
1
+ {"version":3,"file":"approval-line-mutation.js","sourceRoot":"","sources":["../../../server/service/approval-line/approval-line-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,+DAA8D;AAC9D,qCAA4B;AAE5B,iDAAqD;AACrD,mDAA+C;AAC/C,mDAAqE;AACrE,6DAA4E;AAC5E,6DAAyE;AAEzE,KAAK,UAAU,aAAa,CAC1B,YAAgE,EAChE,KAA0C,EAC1C,OAAwB;IAExB,IAAI,CAAC,CAAC,OAAO,IAAI,KAAK,IAAI,WAAW,IAAI,KAAK,CAAC,EAAE,CAAC;QAChD,mDAAmD;QACnD,OAAM;IACR,CAAC;IAED,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;IACpC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,KAAK,CAAA;IAElC,IAAI,CAAC,SAAS,IAAI,CAAC,KAAK,EAAE,CAAC;QACzB,kDAAkD;QAClD,OAAO,IAAI,CAAA;IACb,CAAC;IAED,IAAI,WAAW,CAAA;IAEf,QAAQ,SAAS,IAAI,YAAY,CAAC,SAAS,EAAE,CAAC;QAC5C,KAAK,qCAAqB,CAAC,QAAQ;YACjC,WAAW,GAAG,MAAM,IAAA,qBAAa,EAAC,mBAAQ,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,EAAE,MAA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AAC;GACV,oBAAoB,CAkThC","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { requireMyEmployee } from '../employee/my-employee.js'\nimport { In } from 'typeorm'\n\nimport { getRepository } from '@things-factory/shell'\nimport { Employee } from '../employee/employee'\nimport { ApprovalLine, ApprovalLineOwnerType } from './approval-line'\nimport { ApprovalLineItem, OrgMemberTargetType } from './approval-line-item'\nimport { NewApprovalLine, ApprovalLinePatch } from './approval-line-type'\n\nasync function getOwnerValue(\n approvalLine: ApprovalLine | NewApprovalLine | ApprovalLinePatch,\n patch: NewApprovalLine | ApprovalLinePatch,\n context: ResolverContext\n) {\n if (!('owner' in patch || 'ownerType' in patch)) {\n /* owner 또는 ownerType 하나도 언급되지 않았다면, 업데이트하지 않는다. */\n return\n }\n\n const { domain, tx } = context.state\n const { ownerType, owner } = patch\n\n if (!ownerType || !owner) {\n /* ownerType이 클리어되거나, owner가 지정되지 않았다면, 클리어시킨다. */\n return null\n }\n\n var ownerObject\n\n switch (ownerType || approvalLine.ownerType) {\n case ApprovalLineOwnerType.Employee:\n ownerObject = await getRepository(Employee, tx).findOneBy({ domain: { id: domain.id }, id: owner.id })\n break\n default:\n }\n\n return ownerObject?.id || null\n}\n\nfunction getModelValue(patch: NewApprovalLine | ApprovalLinePatch): ApprovalLineItem[] {\n if (!('model' in patch)) {\n /* model이 언급되지 않았다면, 업데이트하지 않는다. */\n return\n }\n\n const { model } = patch\n\n if (!model || !(model instanceof Array)) {\n /* model의 값이 없거나 배열이 아니라면, 클리어시킨다. */\n return null\n }\n\n return model\n .map(m => {\n /*\n * ── 칸을 하나씩 옮겨 적는 자리다. 새 칸을 여기 안 적으면 조용히 사라진다 ──────────\n * `participation` 과 `notifyAfter` 가 이 목록에 없어서, 편집기에서 「참조」로 고쳐도 저장되지\n * 않았다. 오류도 나지 않는다 — 화면에서는 고쳐지고, 다시 읽으면 결재자로 돌아온다.\n *\n * 두 칸은 `ApprovalLineItem` 에 선언되어 있다(`approval-line-item.ts`). 선언은 있고 쓰는 길이\n * 없던 것이다.\n *\n * `ApprovalLineItem` 에 칸을 더하면 **여기도 함께 고쳐야 한다.**\n */\n return {\n type: m.type,\n approver: m.approver,\n participation: m.participation,\n notifyAfter: m.notifyAfter\n } as ApprovalLineItem\n })\n .filter(m => m.type)\n .filter(m => {\n switch (m.type) {\n case OrgMemberTargetType.Employee:\n case OrgMemberTargetType.Department:\n case OrgMemberTargetType.Role:\n return !!m.approver?.id\n default:\n return true\n }\n })\n}\n\n@Resolver(ApprovalLine)\nexport class ApprovalLineMutation {\n @Directive('@transaction')\n @Directive('@privilege(category: \"organization\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => ApprovalLine, { description: 'To create new ApprovalLine' })\n async createApprovalLine(\n @Arg('approvalLine') approvalLine: NewApprovalLine,\n @Ctx() context: ResolverContext\n ): Promise<ApprovalLine> {\n const { domain, user, tx } = context.state\n\n const result = await getRepository(ApprovalLine, tx).save({\n ...approvalLine,\n ownerValue: await getOwnerValue(approvalLine, approvalLine, context),\n model: getModelValue(approvalLine),\n domain,\n creator: user,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => ApprovalLine, { description: 'To create new ApprovalLine for current user' })\n async createMyApprovalLine(\n @Arg('approvalLine') approvalLine: NewApprovalLine,\n @Ctx() context: ResolverContext\n ): Promise<ApprovalLine> {\n const { domain, user, tx } = context.state\n const employee = await requireMyEmployee(context)\n\n const result = await getRepository(ApprovalLine, tx).save({\n ...approvalLine,\n ownerType: ApprovalLineOwnerType.Employee,\n ownerValue: employee.id,\n model: getModelValue(approvalLine),\n domain,\n creator: user,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"organization\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => ApprovalLine, { description: 'To modify ApprovalLine information' })\n async updateApprovalLine(\n @Arg('id') id: string,\n @Arg('patch') patch: ApprovalLinePatch,\n @Ctx() context: ResolverContext\n ): Promise<ApprovalLine> {\n const { domain, user, tx } = context.state\n\n const repository = getRepository(ApprovalLine, tx)\n const approvalLine = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const result = await repository.save({\n ...approvalLine,\n ...patch,\n ownerValue: await getOwnerValue(approvalLine, patch, context),\n model: getModelValue(patch),\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => ApprovalLine, { description: 'To modify ApprovalLine information for current user' })\n async updateMyApprovalLine(\n @Arg('id') id: string,\n @Arg('patch') patch: ApprovalLinePatch,\n @Ctx() context: ResolverContext\n ): Promise<ApprovalLine> {\n const { domain, user, tx } = context.state\n /*\n * **검사가 여기 없었다.** 사원 기록이 없으면 아래 `employee.id` 에서 null 참조로 터졌고, 그\n * 문장은 옆의 넷이 던지던 것보다 알아보기 어려웠다. 넷은 검사하고 하나는 안 하는 상태가 더 나쁜\n * 이유는, 고친 사람이 「검사가 있다」고 믿게 되기 때문이다.\n */\n const employee = await requireMyEmployee(context)\n\n const repository = getRepository(ApprovalLine, tx)\n const approvalLine = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const result = await repository.save({\n ...approvalLine,\n ...patch,\n ownerType: ApprovalLineOwnerType.Employee,\n ownerValue: employee.id,\n model: getModelValue(patch),\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"organization\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => [ApprovalLine], { description: \"To modify multiple ApprovalLines' information\" })\n async updateMultipleApprovalLine(\n @Arg('patches', type => [ApprovalLinePatch]) patches: ApprovalLinePatch[],\n @Ctx() context: ResolverContext\n ): Promise<ApprovalLine[]> {\n const { domain, user, tx } = context.state\n\n let results = []\n const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')\n const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')\n const approvalLineRepo = getRepository(ApprovalLine, tx)\n\n if (_createRecords.length > 0) {\n for (let i = 0; i < _createRecords.length; i++) {\n const newRecord = _createRecords[i]\n\n const result = await approvalLineRepo.save({\n ...newRecord,\n ownerValue: await getOwnerValue(newRecord, newRecord, context),\n model: getModelValue(newRecord),\n domain,\n creator: user,\n updater: user\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 const approvalLine = await approvalLineRepo.findOne({\n where: { domain: { id: domain.id }, id: updateRecord.id }\n })\n\n if (!approvalLine) {\n throw new Error(`failed to find approvalLine to update: ${updateRecord.id}`)\n }\n\n const result = await approvalLineRepo.save({\n ...approvalLine,\n ...updateRecord,\n ownerValue: await getOwnerValue(approvalLine, updateRecord, context),\n model: getModelValue(updateRecord),\n updater: user\n })\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n }\n\n @Directive('@transaction')\n @Mutation(returns => [ApprovalLine], {\n description: \"To modify multiple ApprovalLines' information for current user\"\n })\n async updateMultipleMyApprovalLine(\n @Arg('patches', type => [ApprovalLinePatch]) patches: ApprovalLinePatch[],\n @Ctx() context: ResolverContext\n ): Promise<ApprovalLine[]> {\n const { domain, user, tx } = context.state\n\n const employee = await requireMyEmployee(context)\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 approvalLineRepo = getRepository(ApprovalLine, tx)\n\n if (_createRecords.length > 0) {\n for (let i = 0; i < _createRecords.length; i++) {\n const newRecord = _createRecords[i]\n\n const result = await approvalLineRepo.save({\n ...newRecord,\n ownerType: ApprovalLineOwnerType.Employee,\n ownerValue: employee.id,\n model: getModelValue(newRecord),\n domain,\n creator: user,\n updater: user\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 const approvalLine = await approvalLineRepo.findOne({\n where: { domain: { id: domain.id }, id: updateRecord.id }\n })\n\n if (!approvalLine) {\n throw new Error(`failed to find approvalLine to update: ${updateRecord.id}`)\n }\n\n const result = await approvalLineRepo.save({\n ...approvalLine,\n ...updateRecord,\n ownerType: ApprovalLineOwnerType.Employee,\n ownerValue: employee.id,\n model: getModelValue(updateRecord),\n updater: user\n })\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"organization\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, { description: 'To delete ApprovalLine' })\n async deleteApprovalLine(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(ApprovalLine, tx).delete({ domain: { id: domain.id }, id })\n\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"organization\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, { description: 'To delete multiple ApprovalLines' })\n async deleteApprovalLines(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(ApprovalLine, tx).delete({\n domain: { id: domain.id },\n id: In(ids)\n })\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete ApprovalLine for current user' })\n async deleteMyApprovalLine(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, user, tx } = context.state\n\n const employee = await requireMyEmployee(context)\n\n await getRepository(ApprovalLine, tx).delete({\n id,\n domain: { id: domain.id },\n ownerType: ApprovalLineOwnerType.Employee,\n ownerValue: employee.id\n })\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple ApprovalLines for current user' })\n async deleteMyApprovalLines(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, user, tx } = context.state\n\n const employee = await requireMyEmployee(context)\n\n await getRepository(ApprovalLine, tx).delete({\n domain: { id: domain.id },\n ownerType: ApprovalLineOwnerType.Employee,\n ownerValue: employee.id,\n id: In(ids)\n })\n\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"organization\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, { description: 'To import multiple ApprovalLines' })\n async importApprovalLines(\n @Arg('approvalLines', type => [ApprovalLinePatch]) approvalLines: ApprovalLinePatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n approvalLines.map(async (approvalLine: ApprovalLinePatch) => {\n const createdApprovalLine: ApprovalLine = await getRepository(ApprovalLine, tx).save({\n domain,\n ...approvalLine\n })\n })\n )\n\n return true\n }\n}\n"]}