@things-factory/organization 10.1.278 → 10.1.280
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +24 -8
- package/CHANGELOG.md +0 -8
- package/dist-client/bootstrap.js.map +0 -1
- package/dist-client/component/approval-line-brief.js.map +0 -1
- package/dist-client/component/approval-line-edit.js.map +0 -1
- package/dist-client/component/approval-line-items-editor-popup.js.map +0 -1
- package/dist-client/component/approval-line-items-editor.js.map +0 -1
- package/dist-client/component/approval-line-selector.js.map +0 -1
- package/dist-client/component/approval-line-templates-manager.js.map +0 -1
- package/dist-client/component/approval-line-view.js.map +0 -1
- package/dist-client/component/assignees-editor-popup.js.map +0 -1
- package/dist-client/component/assignees-editor.js.map +0 -1
- package/dist-client/component/assignees-view.js.map +0 -1
- package/dist-client/component/copy-from.js.map +0 -1
- package/dist-client/component/department-selector.js.map +0 -1
- package/dist-client/component/department-view.js.map +0 -1
- package/dist-client/component/index.js.map +0 -1
- package/dist-client/component/popup-actions-row.test.d.ts +0 -1
- package/dist-client/component/popup-actions-row.test.js +0 -42
- package/dist-client/component/popup-actions-row.test.js.map +0 -1
- package/dist-client/component/recipients-editor-popup.js.map +0 -1
- package/dist-client/component/recipients-editor.js.map +0 -1
- package/dist-client/component/recipients-view.js.map +0 -1
- package/dist-client/entity360/department-360.js.map +0 -1
- package/dist-client/entity360/person-membership-section.js.map +0 -1
- package/dist-client/filters-form/filter-department-object.js.map +0 -1
- package/dist-client/filters-form/ox-filter-department-object.js.map +0 -1
- package/dist-client/grist-editor/grist-editor-approval-line.js.map +0 -1
- package/dist-client/grist-editor/grist-editor-assignees.js.map +0 -1
- package/dist-client/grist-editor/grist-editor-department-object.js.map +0 -1
- package/dist-client/grist-editor/grist-editor-recipients.js.map +0 -1
- package/dist-client/grist-editor/grist-renderer-approval-line.js.map +0 -1
- package/dist-client/grist-editor/grist-renderer-assignees.js.map +0 -1
- package/dist-client/grist-editor/grist-renderer-department-object.js.map +0 -1
- package/dist-client/grist-editor/grist-renderer-recipients.js.map +0 -1
- package/dist-client/index.js.map +0 -1
- package/dist-client/my-picture-model.js.map +0 -1
- package/dist-client/my-picture.js.map +0 -1
- package/dist-client/pages/approval-line/approval-line-list-page.js.map +0 -1
- package/dist-client/pages/approval-line/common-approval-line-templates-page.js.map +0 -1
- package/dist-client/pages/approval-line/my-approval-line-templates-page.js.map +0 -1
- package/dist-client/pages/department/department-importer.js.map +0 -1
- package/dist-client/pages/department/department-list-page.js.map +0 -1
- package/dist-client/pages/department/department-patch.js.map +0 -1
- package/dist-client/pages/employee/employee-importer.js.map +0 -1
- package/dist-client/pages/employee/employee-list-page.js.map +0 -1
- package/dist-client/pages/employee-profile/employee-profile-files.js.map +0 -1
- package/dist-client/pages/employee-profile/employee-profile-form.js.map +0 -1
- package/dist-client/pages/employee-profile/employee-profile-list-page.js.map +0 -1
- package/dist-client/pages/employee-profile/employee-profile-preview.js.map +0 -1
- package/dist-client/pages/employee-profile/my-employee-profile-page.js.map +0 -1
- package/dist-client/route.js.map +0 -1
- package/dist-client/tsconfig.tsbuildinfo +0 -1
- package/dist-client/types/approval-line.js.map +0 -1
- package/dist-client/types/contact.js.map +0 -1
- package/dist-client/types/department.js.map +0 -1
- package/dist-client/types/employee.js.map +0 -1
- package/dist-client/types/index.js.map +0 -1
- package/dist-client/types/org-member.js.map +0 -1
- package/dist-server/ai-entry/employee-profile-entry.js.map +0 -1
- package/dist-server/ai-entry/entry-target-shape.js.map +0 -1
- package/dist-server/ai-entry/organization-entry-rules.js.map +0 -1
- package/dist-server/ai-entry/organization-entry-targets.js.map +0 -1
- package/dist-server/controllers/register-employee-as-system-user.js.map +0 -1
- package/dist-server/index.js.map +0 -1
- package/dist-server/migrations/1723861013111-seed-organization-codes.js.map +0 -1
- package/dist-server/migrations/index.js.map +0 -1
- package/dist-server/role-tasks.js.map +0 -1
- package/dist-server/routes.js.map +0 -1
- package/dist-server/service/approval-line/approval-line-item.js.map +0 -1
- package/dist-server/service/approval-line/approval-line-mutation.js.map +0 -1
- package/dist-server/service/approval-line/approval-line-query.js.map +0 -1
- package/dist-server/service/approval-line/approval-line-type.js.map +0 -1
- package/dist-server/service/approval-line/approval-line.js.map +0 -1
- package/dist-server/service/approval-line/index.js.map +0 -1
- package/dist-server/service/audience/audience-member.js.map +0 -1
- package/dist-server/service/audience/audience.js.map +0 -1
- package/dist-server/service/certificate/employment-certificate-rules.js.map +0 -1
- package/dist-server/service/certificate/employment-certificate-templates.js.map +0 -1
- package/dist-server/service/certificate/employment-certificates.js.map +0 -1
- package/dist-server/service/department/department-history.js.map +0 -1
- package/dist-server/service/department/department-mutation.js.map +0 -1
- package/dist-server/service/department/department-parent.js.map +0 -1
- package/dist-server/service/department/department-query.js.map +0 -1
- package/dist-server/service/department/department-type.js.map +0 -1
- package/dist-server/service/department/department.js.map +0 -1
- package/dist-server/service/department/event-subscriber.js.map +0 -1
- package/dist-server/service/department/index.js.map +0 -1
- package/dist-server/service/domain-reference.js.map +0 -1
- package/dist-server/service/employee/employee-control-no.js.map +0 -1
- package/dist-server/service/employee/employee-day.js.map +0 -1
- package/dist-server/service/employee/employee-history.js.map +0 -1
- package/dist-server/service/employee/employee-mutation.js.map +0 -1
- package/dist-server/service/employee/employee-private.js.map +0 -1
- package/dist-server/service/employee/employee-query.js.map +0 -1
- package/dist-server/service/employee/employee-type.js.map +0 -1
- package/dist-server/service/employee/employee.js.map +0 -1
- package/dist-server/service/employee/event-subscriber.js.map +0 -1
- package/dist-server/service/employee/index.js.map +0 -1
- package/dist-server/service/employee/my-employee-refusal.js.map +0 -1
- package/dist-server/service/employee/my-employee.js.map +0 -1
- package/dist-server/service/employee/working-employees.js.map +0 -1
- package/dist-server/service/employee-profile/employee-profile-document.js.map +0 -1
- package/dist-server/service/employee-profile/employee-profile-mutation.js.map +0 -1
- package/dist-server/service/employee-profile/employee-profile-query.js.map +0 -1
- package/dist-server/service/employee-profile/employee-profile-rows.js.map +0 -1
- package/dist-server/service/employee-profile/employee-profile-rules.js.map +0 -1
- package/dist-server/service/employee-profile/employee-profile-type.js.map +0 -1
- package/dist-server/service/employee-profile/employee-profile.js.map +0 -1
- package/dist-server/service/employee-profile/index.js.map +0 -1
- package/dist-server/service/index.js.map +0 -1
- package/dist-server/tsconfig.tsbuildinfo +0 -1
- package/dist-server/work-doors.js.map +0 -1
- package/spec/unit/approval-line.spec.ts +0 -329
- package/spec/unit/department.spec.ts +0 -253
- package/spec/unit/employee.spec.ts +0 -271
- package/spec/unit/my-employee.spec.ts +0 -102
- package/tests/approval-line-brief-plan.test.ts +0 -35
- package/tests/approval-line-edit.test.ts +0 -78
- package/tests/approval-line-mark.test.ts +0 -68
- package/tests/approval-line-step-fields.test.ts +0 -108
- package/tests/assignees-editor-no-role.test.ts +0 -32
- package/tests/audience.test.ts +0 -85
- package/tests/copy-from.test.ts +0 -17
- package/tests/department-open-fields.test.ts +0 -72
- package/tests/department-parent.test.ts +0 -187
- package/tests/department-patch.test.ts +0 -52
- package/tests/department-query-shape.test.ts +0 -130
- package/tests/department-selector.test.ts +0 -32
- package/tests/domain-reference.test.ts +0 -186
- package/tests/employee-day.test.ts +0 -165
- package/tests/employee-private.test.ts +0 -37
- package/tests/employee-profile-db.test.ts +0 -261
- package/tests/employee-profile-document.test.ts +0 -282
- package/tests/employee-profile-entry.test.ts +0 -72
- package/tests/employee-profile-rules.test.ts +0 -103
- package/tests/entity360.test.ts +0 -36
- package/tests/my-picture.test.ts +0 -21
- package/tests/organization-entry-targets.test.ts +0 -236
- package/tests/refusals-in-korean.test.ts +0 -48
- package/tests/register-employee-role.test.ts +0 -97
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contact.js","sourceRoot":"","sources":["../../client/types/contact.ts"],"names":[],"mappings":"AAEA,MAAM,CAAN,IAAY,YAWX;AAXD,WAAY,YAAY;IACtB,6BAAa,CAAA;IACb,sCAAsB,CAAA;IACtB,+BAAe,CAAA;IACf,mCAAmB,CAAA;IACnB,+BAAe,CAAA;IACf,qCAAqB,CAAA;IACrB,mCAAmB,CAAA;IACnB,mCAAmB,CAAA;IACnB,yCAAyB,CAAA;IACzB,qCAAqB,CAAA;AACvB,CAAC,EAXW,YAAY,KAAZ,YAAY,QAWvB;AAED,MAAM,OAAO,WAAW;CAIvB;AAED,MAAM,OAAO,OAAO;CAMnB;AAED,MAAM,OAAO,OAAO;CAqBnB","sourcesContent":["import { Domain, User } from '@operato/shell'\n\nexport enum ContactField {\n Name = 'name',\n JobTitle = 'job-title',\n Phone = 'phone',\n Address = 'address',\n Email = 'email',\n Birthday = 'birthday',\n Profile = 'profile',\n Picture = 'picture',\n Department = 'department',\n Homepage = 'homepage'\n}\n\nexport class ContactItem {\n label?: string\n type?: ContactField\n value?: string\n}\n\nexport class Profile {\n left?: number\n top?: number\n zoom?: number\n\n picture?: string\n}\n\nexport class Contact {\n readonly id?: string\n\n domain?: Domain\n name?: string\n /* The counterparty the person belongs to - a biz-base counterparty of the same domain. */\n counterparty?: { id: string; name?: string } | null\n email?: string\n phone?: string\n address?: string\n department?: string\n note?: string\n profile?: Profile\n items?: ContactItem[]\n\n createdAt?: Date\n updatedAt?: Date\n deletedAt?: Date\n\n creator?: User\n updater?: User\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"department.js","sourceRoot":"","sources":["../../client/types/department.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,UAAU;CAyBtB","sourcesContent":["import { Domain, User } from '@operato/shell'\nimport { Employee } from './employee'\n\nexport class Department {\n readonly id?: string\n\n domain?: Domain\n\n controlNo?: string\n name?: string\n description?: string\n\n parent?: Department\n children?: Department[]\n\n manager?: Employee\n\n extension?: string\n picture?: string\n\n active?: boolean\n\n createdAt?: Date\n updatedAt?: Date\n deletedAt?: Date\n\n creator?: User\n updater?: User\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"employee.js","sourceRoot":"","sources":["../../client/types/employee.ts"],"names":[],"mappings":"AAIA,MAAM,CAAN,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,qCAAqB,CAAA;IACrB,qCAAqB,CAAA;IACrB,uCAAuB,CAAA;AACzB,CAAC,EAJW,YAAY,KAAZ,YAAY,QAIvB;AAED,MAAM,CAAN,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,uCAAqB,CAAA;IACrB,uCAAqB,CAAA;AACvB,CAAC,EAHW,cAAc,KAAd,cAAc,QAGzB;AAED,MAAM,OAAO,QAAQ;IAArB;QAGE,YAAO,GAAY,CAAC,CAAA;IA+BtB,CAAC;CAAA","sourcesContent":["import { Domain, User } from '@operato/shell'\nimport { Department } from './department'\nimport { Contact } from './contact'\n\nexport enum EmployeeType {\n FULLTIME = 'FULLTIME',\n PARTTIME = 'PARTTIME',\n TEMPORARY = 'TEMPORARY'\n}\n\nexport enum EmployeeStatus {\n STATUS_A = 'STATUS_A',\n STATUS_B = 'STATUS_B'\n}\n\nexport class Employee {\n readonly id?: string\n\n version?: number = 1\n\n domain?: Domain\n\n controlNo?: string\n name?: string\n\n supervisor?: Employee\n supervises?: Employee[]\n\n department?: Department\n manages?: Department[]\n\n active?: boolean\n type?: EmployeeType\n extension?: string\n photo?: string\n user?: User\n contact?: Contact\n\n email?: string\n phone?: string\n note?: string\n hiredOn?: string\n\n createdAt?: Date\n updatedAt?: Date\n deletedAt?: Date\n\n creator?: User\n updater?: User\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../client/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA","sourcesContent":["export * from './approval-line'\nexport * from './contact'\nexport * from './department'\nexport * from './employee'\nexport * from './org-member'\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"org-member.js","sourceRoot":"","sources":["../../client/types/org-member.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,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,KAAnB,mBAAmB,QAO9B;AAED,MAAM,OAAO,eAAe;CAK3B;AAED,MAAM,OAAO,YAAY;CAIxB;AAED,MAAM,OAAO,aAAa;CAIzB","sourcesContent":["export enum OrgMemberTargetType {\n Employee = 'Employee',\n Department = 'Department',\n Role = 'Role',\n Myself = 'Myself',\n MyDepartment = 'MyDepartment',\n MySupervisor = 'MySupervisor'\n}\n\nexport class OrgMemberTarget {\n id?: string\n name?: string\n description?: string\n controlNo?: string\n}\n\nexport class AssigneeItem {\n type?: OrgMemberTargetType\n value?: string\n assignee?: OrgMemberTarget\n}\n\nexport class RecipientItem {\n type?: OrgMemberTargetType\n value?: string\n recipient?: OrgMemberTarget\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"employee-profile-entry.js","sourceRoot":"","sources":["../../server/ai-entry/employee-profile-entry.ts"],"names":[],"mappings":";;;AAgEA,8CAYC;AAGD,gDAUC;AAGD,kDAEC;AAtFY,QAAA,sBAAsB,GAAG,CAAC,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,QAAQ,EAAE,SAAS,CAAU,CAAA;AAIpH,yDAAyD;AACzD,MAAM,MAAM,GAAwC;IAClD,OAAO,EAAE,MAAM;IACf,KAAK,EAAE,MAAM;IACb,SAAS,EAAE,QAAQ;IACnB,WAAW,EAAE,MAAM;IACnB,MAAM,EAAE,SAAS;IACjB,OAAO,EAAE,MAAM;CAChB,CAAA;AAED,iFAAiF;AACjF,MAAM,KAAK,GAAkG;IAC3G,SAAS,EAAE,EAAE,IAAI,EA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,SAAS,EAAE,IAAI,EAAE,aAAa,EAAE,UAAU,EAAE,6CAA6C,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAA;QACpL,OAAO,MAAM,CAAA;IACf,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,wDAAwD;AACxD,SAAgB,mBAAmB,CAAC,IAAgB;IAClD,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC,IAAI,IAAI,CAAC,MAAM,EAAE,CAAA;AAClE,CAAC","sourcesContent":["/*\n * The person's own career profile as rows the assistant proposes from a résumé they attached or what they said\n * (ADR-0169 decision 10). A profile is one document of sections whose rows differ in shape, so a row names its\n * section and carries that section's fields; the rows of a section go in by one call of `addToMyEmployeeProfile`.\n * Pure - the declaration (organization-entry-targets.ts) only wires these.\n */\nimport type { EntryField, EntryIssue, EntryRow } from './entry-target-shape'\n\nexport const PROFILE_ENTRY_SECTIONS = ['summary', 'skill', 'education', 'certificate', 'career', 'project'] as const\n\nexport type ProfileEntrySection = (typeof PROFILE_ENTRY_SECTIONS)[number]\n\n/** The field a row of each section cannot go without. */\nconst NEEDED: Record<ProfileEntrySection, string> = {\n summary: 'text',\n skill: 'text',\n education: 'school',\n certificate: 'name',\n career: 'company',\n project: 'name'\n}\n\n/** What each section takes into the profile's document, and under which list. */\nconst TAKEN: Record<Exclude<ProfileEntrySection, 'summary' | 'skill'>, { list: string; fields: string[] }> = {\n education: { list: 'educations', fields: ['school', 'major', 'degree', 'startedOn', 'endedOn'] },\n certificate: { list: 'certificates', fields: ['name', 'issuer', 'acquiredOn'] },\n career: { list: 'careers', fields: ['company', 'department', 'position', 'startedOn', 'endedOn', 'duties'] },\n project: { list: 'projects', fields: ['name', 'client', 'startedOn', 'endedOn', 'role', 'duties', 'technologies'] }\n}\n\nconst label = (name: string) => `label.employee-profile-${name}`\nconst month = 'YYYY-MM as the résumé gives it (2023-03); leave it out when the résumé gives no month'\n\nexport const PROFILE_ENTRY_FIELDS: EntryField[] = [\n {\n name: 'section',\n type: 'enum',\n required: true,\n values: [...PROFILE_ENTRY_SECTIONS],\n valueKeyPrefix: 'text.organization-entry-profile-section-',\n labelKey: 'label.organization-entry-profile-section',\n description: 'which part of the profile the row is: summary (one row, a few sentences), skill (one row a skill), education, certificate, career (a job before this company), project'\n },\n { name: 'text', type: 'text', labelKey: 'label.organization-entry-profile-text', description: 'summary: the few sentences about the person, in their words; skill: one skill, a word or two (TypeScript, PLC, PMP)' },\n { name: 'school', type: 'string', labelKey: label('school'), description: 'education: the school' },\n { name: 'major', type: 'string', labelKey: label('major'), description: 'education: the major' },\n { name: 'degree', type: 'string', labelKey: label('degree'), description: 'education: the degree - 학사, 석사, 박사, 고졸' },\n { name: 'name', type: 'string', labelKey: 'label.organization-entry-profile-name', description: 'certificate: its name; project: the project name' },\n { name: 'issuer', type: 'string', labelKey: label('issuer'), description: 'certificate: who issued it' },\n { name: 'acquiredOn', type: 'string', labelKey: label('acquired-on'), description: 'certificate: the day it was acquired, YYYY-MM-DD, or YYYY-MM when only the month is given' },\n { name: 'company', type: 'string', labelKey: label('company'), description: 'career: the company' },\n { name: 'department', type: 'string', labelKey: 'label.department', description: 'career: the department' },\n { name: 'position', type: 'string', labelKey: label('position'), description: 'career: the position held' },\n { name: 'client', type: 'string', labelKey: label('client'), description: 'project: the client it was done for' },\n { name: 'role', type: 'string', labelKey: label('role'), description: 'project: the role - PM, PL, 설계, 개발' },\n { name: 'technologies', type: 'string', labelKey: label('technologies'), description: 'project: the technologies used, comma separated' },\n { name: 'duties', type: 'text', labelKey: label('duties'), description: 'career or project: what the person did' },\n { name: 'startedOn', type: 'string', labelKey: label('started-on'), description: `education, career or project: when it began - ${month}` },\n { name: 'endedOn', type: 'string', labelKey: label('ended-on'), description: `education, career or project: when it ended - ${month}; leave it out when it is still going on` }\n]\n\nconst text = (value: unknown) => (typeof value === 'string' ? value.trim() : value === undefined || value === null ? '' : String(value).trim())\n\n/** The rows of one section as what `addToMyEmployeeProfile` takes. */\nexport function profileAdditionOf(rows: EntryRow[]): Record<string, unknown> {\n const addition: Record<string, unknown> = {}\n for (const row of rows) {\n const section = row.values.section as ProfileEntrySection\n if (section === 'summary') addition.summary = text(row.values.text)\n else if (section === 'skill') addition.skills = [...((addition.skills as string[]) ?? []), text(row.values.text)]\n else if (TAKEN[section]) {\n const { list, fields } = TAKEN[section]\n addition[list] = [...((addition[list] as unknown[]) ?? []), Object.fromEntries(fields.map(field => [field, text(row.values[field])]))]\n }\n }\n return addition\n}\n\n/** A row without what its section cannot go without is kept out; a second summary is too - the profile has one. */\nexport function profileEntryIssues(rows: EntryRow[]): EntryIssue[][] {\n const firstSummary = rows.find(row => row.values.section === 'summary')\n return rows.map(row => {\n const section = row.values.section as ProfileEntrySection\n const needed = NEEDED[section]\n const issues: EntryIssue[] = []\n if (needed && !text(row.values[needed])) issues.push({ field: needed, code: 'required', blocking: true })\n if (section === 'summary' && row !== firstSummary) issues.push({ field: 'section', code: 'one-summary', messageKey: 'text.organization-entry-profile-one-summary', blocking: true })\n return issues\n })\n}\n\n/** The card's line for a section entered - 「프로젝트 3」. */\nexport function profileAppliedLabel(rows: EntryRow[]): string {\n return `${String(rows[0]?.values.section ?? '')} ${rows.length}`\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"entry-target-shape.js","sourceRoot":"","sources":["../../server/ai-entry/entry-target-shape.ts"],"names":[],"mappings":"","sourcesContent":["/*\n * The shape of an AI 입력 (data entry) target - the same shape as `EntryTarget` in\n * @things-factory/ai-assistant (server/service/data-entry/entry-target.ts).\n *\n * Kept here as a structural copy so that this package declares its targets as plain data and does not\n * depend on the assistant at run time. An application that runs the assistant passes these declarations\n * to `registerEntryTarget`; the assistant validates them at boot.\n */\nexport type EntryFieldType = 'string' | 'text' | 'number' | 'integer' | 'date' | 'datetime' | 'boolean' | 'enum' | 'reference'\n\nexport interface EntryReference {\n query: string\n variables(text: string): Record<string, unknown>\n recordsOf(data: any, text: string): { id: string; label?: string }[]\n}\n\nexport interface EntryField {\n name: string\n type: EntryFieldType\n required?: boolean\n values?: string[]\n description?: string\n labelKey?: string\n total?: boolean\n valueKeyPrefix?: string\n reference?: EntryReference\n}\n\nexport interface EntryIssue {\n field?: string\n code: string\n messageKey?: string\n params?: Record<string, unknown>\n blocking: boolean\n}\n\nexport interface EntryRow {\n index: number\n values: Record<string, unknown>\n sources: unknown[]\n issues: EntryIssue[]\n}\n\nexport type EntryRecord = { id: string } & Record<string, unknown>\n\nexport interface EntryUpdate {\n read: { query: string; variables(ids: string[]): Record<string, unknown>; recordsOf(data: any, ids: string[]): EntryRecord[] }\n find?: {\n query: string\n variables(criteria: Record<string, unknown>): Record<string, unknown>\n recordsOf(data: any, criteria: Record<string, unknown>): EntryRecord[]\n criteria: EntryField[]\n }\n mutation: string\n variables(change: { id: string; record: EntryRecord; values: Record<string, unknown> }): Record<string, unknown>\n labelOf?(record: EntryRecord): string\n fields?: string[]\n /** Read-only checks of the changes, asked when the card is made and again when it is pressed - one issue list per row. */\n check?(rows: { id: string; record?: EntryRecord; values: Record<string, unknown> }[], context: { state: any }): EntryIssue[][] | Promise<EntryIssue[][]>\n}\n\nexport interface EntryTargetDeclaration {\n key: string\n labelKey: string\n description: string\n fields: EntryField[]\n mutation: string\n /** The mutation's variables for one row. Absent when the target enters rows by group. */\n variables?(row: EntryRow): Record<string, unknown>\n appliedOf?(data: any, row: EntryRow): { id?: string; label?: string } | undefined\n /** Rows sharing the value of `by` are one call of the mutation with `variables(rows)`. */\n group?: {\n by: string\n variables(rows: EntryRow[]): Record<string, unknown>\n appliedOf?(data: any, rows: EntryRow[]): { id?: string; label?: string } | undefined\n }\n maxRows?: number\n check?(rows: EntryRow[], context: { state: any }): EntryIssue[][] | Promise<EntryIssue[][]>\n update?: EntryUpdate\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"organization-entry-rules.js","sourceRoot":"","s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C,KAAK,SAAS,CAAC,CAAC;YACvJ,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,uBAAuB,EAAE,UAAU,EAAE,6CAA6C,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAA;QAE3H,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,MAAM;YAAE,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,aAAa,EAAE,UAAU,EAAE,gDAAgD,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAA;QAC9J,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,WAAW;YAAE,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,kBAAkB,EAAE,UAAU,EAAE,qDAAqD,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAA;QAE7K,OAAO,MAAM,CAAA;IACf,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,+GAA+G;AAC/G,SAAgB,eAAe,CAAC,MAA+B;IAC7D,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAA;IAC5B,OAAO,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,OAAQ,MAAc,CAAC,EAAE,KAAK,QAAQ,CAAC,CAAC,CAAE,MAAc,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;AACxH,CAAC;AAED,oHAAoH;AACpH,SAAgB,eAAe,CAAC,KAAc;IAC5C,MAAM,IAAI,GAAI,KAAa,EAAE,IAAI,CAAA;IACjC,IAAI,IAAI,KAAK,wBAAwB;QAAE,OAAO,MAAM,CAAA;IACpD,IAAI,IAAI,KAAK,6BAA6B;QAAE,OAAO,WAAW,CAAA;IAC9D,OAAO,SAAS,CAAA;AAClB,CAAC","sourcesContent":["/*\n * The rules a proposed department or employee row passes - pure, so they are tested without a server.\n * The targets (organization-entry-targets.ts) read what is already entered and hand it here.\n */\nimport type { EntryIssue, EntryRecord } from './entry-target-shape'\n\ntype Row = { values: Record<string, unknown> }\n\nconst text = (value: unknown) => (typeof value === 'string' || typeof value === 'number' ? String(value).trim() : '')\n\n/** A reference the row still names in words - `{ text }` - because the query found nothing (or several). */\nconst unresolvedText = (value: unknown) => (value && typeof value === 'object' && typeof (value as any).text === 'string' ? (value as any).text.trim() : '')\n\n/** Only the fields given, and a reference as its id alone - `{ id }` is what the mutation's ObjectRef takes. */\nexport function inputOf(values: Record<string, unknown>, names: string[], references: string[] = []): Record<string, unknown> {\n const input: Record<string, unknown> = {}\n for (const name of names) {\n if (!(name in values) || values[name] === undefined) continue\n const value = values[name]\n if (references.includes(name)) input[name] = value && typeof value === 'object' && typeof (value as any).id === 'string' ? { id: (value as any).id } : null\n else input[name] = value\n }\n return input\n}\n\n/**\n * A department row against what the domain already has and the other rows of the proposal.\n *\n * Name and 관리번호 are each unique in a domain (ix_department_0, ix_department_1) - one already there keeps the\n * row out, and so does a row that repeats an earlier row of the same proposal (the later one is kept out).\n * Rows are entered one by one in no order the framework promises, so a parent named by another row of the\n * same proposal does not exist yet when this row runs: the row is kept out and the person enters the parent first.\n */\nexport function departmentIssues(rows: Row[], existing: { name?: string | null; controlNo?: string | null }[]): EntryIssue[][] {\n const names = new Set(existing.map(one => text(one.name)).filter(Boolean))\n const codes = new Set(existing.map(one => text(one.controlNo)).filter(Boolean))\n\n return rows.map((row, i) => {\n const issues: EntryIssue[] = []\n const name = text(row.values.name)\n const controlNo = text(row.values.controlNo)\n\n if (name && names.has(name)) issues.push({ field: 'name', code: 'duplicate', messageKey: 'text.organization-entry-department-name-exists', blocking: true })\n if (controlNo && codes.has(controlNo))\n issues.push({ field: 'controlNo', code: 'duplicate', messageKey: 'text.organization-entry-department-control-no-exists', blocking: true })\n\n const earlier = rows.slice(0, i)\n if (\n (name && earlier.some(other => text(other.values.name) === name)) ||\n (controlNo && earlier.some(other => text(other.values.controlNo) === controlNo))\n )\n issues.push({ code: 'duplicate-in-proposal', messageKey: 'text.organization-entry-department-repeated', blocking: true })\n\n const parent = unresolvedText(row.values.parent)\n if (parent && rows.some((other, j) => j !== i && (text(other.values.name) === parent || text(other.values.controlNo) === parent)))\n issues.push({ field: 'parent', code: 'parent-in-proposal', messageKey: 'text.organization-entry-department-parent-first', params: { parent }, blocking: true })\n\n return issues\n })\n}\n\n/** An employee row - the 사번 (controlNo) is unique in a domain among the employees not deleted (ix_employee_0). */\nexport function employeeIssues(rows: Row[], existing: { controlNo?: string | null }[]): EntryIssue[][] {\n const codes = new Set(existing.map(one => text(one.controlNo)).filter(Boolean))\n return rows.map((row, i) => {\n const controlNo = text(row.values.controlNo)\n if (!controlNo) return []\n if (codes.has(controlNo)) return [{ field: 'controlNo', code: 'duplicate', messageKey: 'text.organization-entry-employee-exists', blocking: true }]\n if (rows.slice(0, i).some(other => text(other.values.controlNo) === controlNo))\n return [{ field: 'controlNo', code: 'duplicate-in-proposal', messageKey: 'text.organization-entry-employee-repeated', blocking: true }]\n return []\n })\n}\n\n/** The departments a name or a 관리번호 names - exactly, never a piece of it. */\nexport function departmentsNamed(items: { id: string; name?: string | null; controlNo?: string | null }[], said: string): { id: string; label: string }[] {\n const wanted = said.trim().toLowerCase()\n if (!wanted) return []\n return items\n .filter(one => text(one.name).toLowerCase() === wanted || text(one.controlNo).toLowerCase() === wanted)\n .map(one => ({ id: one.id, label: codeAndName(one) }))\n}\n\n/** The records whose every given criterion is a piece of the field - \"영업\" finds 영업1팀 and 영업2팀. */\nexport function matching(records: EntryRecord[], criteria: Record<string, unknown>): EntryRecord[] {\n const given = Object.entries(criteria ?? {}).filter(([, value]) => text(value))\n return records.filter(record => given.every(([name, value]) => text(record[name]).toLowerCase().includes(text(value).toLowerCase())))\n}\n\nexport function codeAndName(record: Record<string, unknown>): string {\n return [text(record.controlNo), text(record.name)].filter(Boolean).join(' · ')\n}\n\n/** What the department's own parent rule (checkedParent) said of a changed parent - read only, before the change runs. */\nexport type ParentVerdict = 'loop' | 'not-found' | undefined\n\n/**\n * A change of a department against the other departments of the domain and the other changes of the card.\n *\n * A new name or 관리번호 another department already has (the record itself excepted) keeps the change out, and so\n * does one an earlier change of the same card gives. A parent that is the department itself or one of its own\n * sub-departments - or one the person cannot see - keeps it out too, as `updateDepartment` would refuse it.\n */\nexport function departmentChangeIssues(\n rows: { id: string; values: Record<string, unknown> }[],\n existing: { id: string; name?: string | null; controlNo?: string | null }[],\n parents: ParentVerdict[] = []\n): EntryIssue[][] {\n return rows.map((row, i) => {\n const issues: EntryIssue[] = []\n const name = 'name' in row.values ? text(row.values.name) : ''\n const controlNo = 'controlNo' in row.values ? text(row.values.controlNo) : ''\n const others = existing.filter(one => one.id !== row.id)\n\n if (name && others.some(one => text(one.name) === name))\n issues.push({ field: 'name', code: 'duplicate', messageKey: 'text.organization-entry-department-name-exists', blocking: true })\n if (controlNo && others.some(one => text(one.controlNo) === controlNo))\n issues.push({ field: 'controlNo', code: 'duplicate', messageKey: 'text.organization-entry-department-control-no-exists', blocking: true })\n\n const earlier = rows.slice(0, i).filter(other => other.id !== row.id)\n if ((name && earlier.some(other => text(other.values.name) === name)) || (controlNo && earlier.some(other => text(other.values.controlNo) === controlNo)))\n issues.push({ code: 'duplicate-in-proposal', messageKey: 'text.organization-entry-department-repeated', blocking: true })\n\n if (parents[i] === 'loop') issues.push({ field: 'parent', code: 'parent-loop', messageKey: 'text.organization-entry-department-parent-loop', blocking: true })\n if (parents[i] === 'not-found') issues.push({ field: 'parent', code: 'parent-not-found', messageKey: 'text.organization-entry-department-parent-not-found', blocking: true })\n\n return issues\n })\n}\n\n/** The id of a changed parent - `{ id }` when the reference was resolved; anything else is not asked about. */\nexport function changedParentId(values: Record<string, unknown>): string | undefined {\n const parent = values.parent\n return parent && typeof parent === 'object' && typeof (parent as any).id === 'string' ? (parent as any).id : undefined\n}\n\n/** checkedParent's refusal as a verdict - any other error (the database, say) is not a verdict and is passed on. */\nexport function parentVerdictOf(error: unknown): ParentVerdict {\n const code = (error as any)?.code\n if (code === 'department-parent-loop') return 'loop'\n if (code === 'department-parent-not-found') return 'not-found'\n return undefined\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"organization-entry-targets.js","sourceRoot":"","sources":["../../server/ai-entry/organization-entry-targets.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0EA,sDAiGC;AA2BD,kDAmBC;AAOD,4DAEC;AAQD,gEAgBC;AA7OD,qEAA2H;AAC3H,yEAWmC;AAEtB,QAAA,uBAAuB,GAAG,yBAAyB,CAAA;AACnD,QAAA,qBAAqB,GAAG,uBAAuB,CAAA;AAC/C,QAAA,6BAA6B,GAAG,+BAA+B,CAAA;AAE5E,4HAA4H;AAC5H,MAAM,mBAAmB,GACvB,kJAAkJ,CAAA;AAEpJ,MAAM,WAAW,GACf,4MAA4M,CAAA;AAE9M,4HAA4H;AAC5H,MAAM,mBAAmB,GAAG;IAC1B,KAAK,EAAE,mBAAmB;IAC1B,SAAS,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC;QAC5B,OAAO,EAAE;YACP,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE;YACjD,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE;SACvD;QACD,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE;KACpC,CAAC;IACF,SAAS,EAAE,CAAC,IAAS,EAAE,IAAY,EAAE,EAAE,CAAC,IAAA,2CAAgB,EAAC,IAAI,EAAE,WAAW,EAAE,KAAK,IAAI,EAAE,EAAE,IAAI,CAAC;CAC/F,CAAA;AAED,MAAM,iBAAiB,GAAiB;IACtC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,kBAAkB,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CAAC,IAAA,2CAAkB,EAAC,IAAI,CAAC;KACxC,CAAA;AACH,CAAC","sourcesContent":["/*\n * AI 입력 targets of the organization - what an application may hand its assistant so that departments\n * (and, only by an explicit product decision, employees) are entered from material\n * (operato-application/design/ai/data-entry.md).\n *\n * Plain declarations: this package does not depend on @things-factory/ai-assistant. An application that runs\n * the assistant passes them to `registerEntryTarget` and names their keys in its modes. Every row is entered\n * through the organization's own mutation, run as the person - the same `@privilege` and checks as the screens.\n *\n * The checks read through the repository of the request's domain only, and import it when they run, so that\n * reading these declarations stays light.\n */\nimport type { EntryField, EntryRow, EntryTargetDeclaration } from './entry-target-shape'\nimport { profileAdditionOf, profileAppliedLabel, profileEntryIssues, PROFILE_ENTRY_FIELDS } from './employee-profile-entry'\nimport {\n changedParentId,\n codeAndName,\n departmentChangeIssues,\n departmentIssues,\n departmentsNamed,\n employeeIssues,\n inputOf,\n matching,\n parentVerdictOf,\n type ParentVerdict\n} from './organization-entry-rules'\n\nexport const ORGANIZATION_DEPARTMENT = 'organization.department'\nexport const ORGANIZATION_EMPLOYEE = 'organization.employee'\nexport const ORGANIZATION_EMPLOYEE_PROFILE = 'organization.employee-profile'\n\n/** Departments of the person's domain whose name or 관리번호 holds the text - `search` filters are OR'd by the list builder. */\nconst DEPARTMENTS_BY_TEXT =\n 'query ($filters: [Filter!], $pagination: Pagination) { departments(filters: $filters, pagination: $pagination) { items { id controlNo name } } }'\n\nconst DEPARTMENTS =\n 'query ($filters: [Filter!], $pagination: Pagination) { departments(filters: $filters, pagination: $pagination) { items { id controlNo name description active extension parent { id controlNo name } } } }'\n\n/** A department the model names in words, found as the person through `departments` - the id is what the mutation takes. */\nconst departmentReference = {\n query: DEPARTMENTS_BY_TEXT,\n variables: (said: string) => ({\n filters: [\n { name: 'name', operator: 'search', value: said },\n { name: 'controlNo', operator: 'search', value: said }\n ],\n pagination: { page: 1, limit: 200 }\n }),\n recordsOf: (data: any, said: string) => departmentsNamed(data?.departments?.items ?? [], said)\n}\n\nconst DEPARTMENT_FIELDS: EntryField[] = [\n { name: 'controlNo', type: 'string', required: true, labelKey: 'field.control-no', description: \"the department's code (관리번호) as the material writes it\" },\n { name: 'name', type: 'string', required: true, labelKey: 'field.name', description: 'the department name' },\n { name: 'description', type: 'string', labelKey: 'field.description' },\n { name: 'active', type: 'boolean', labelKey: 'field.active', description: 'false only when the material says the department is closed or not in use' },\n { name: 'extension', type: 'string', labelKey: 'field.extension', description: \"the department's phone extension (내선 번호)\" },\n {\n name: 'parent',\n type: 'reference',\n labelKey: 'field.parent-department',\n description: 'the department it belongs under, by its name or 관리번호. Leave it out for a top-level department.',\n reference: departmentReference\n }\n]\n\n/* DepartmentPatch has no `extension` - the update changes only what the patch can carry. */\nconst DEPARTMENT_UPDATE_FIELDS = ['controlNo', 'name', 'description', 'active', 'parent']\n\n/*\n * Never taken: `manager` (a person, picked on the screen) and `picture` (a file upload).\n */\nconst DEPARTMENT_CREATE_FIELDS = DEPARTMENT_FIELDS.map(field => field.name)\n\nexport function departmentEntryTarget(): EntryTargetDeclaration {\n return {\n key: ORGANIZATION_DEPARTMENT,\n labelKey: 'label.organization-entry-department',\n description:\n 'one department of the organization: its code (관리번호), its name, a description, its phone extension, whether it is active, and the department it belongs under.',\n mutation: 'mutation ($department: NewDepartment!) { createDepartment(department: $department) { id controlNo name } }',\n fields: DEPARTMENT_FIELDS,\n maxRows: 200,\n variables: (row: EntryRow) => ({ department: inputOf(row.values, DEPARTMENT_CREATE_FIELDS, ['parent']) }),\n appliedOf: (data, row) => ({ id: data?.createDepartment?.id, label: codeAndName(data?.createDepartment ?? row.values) }),\n\n check: async (rows, { state }) => {\n const domainId = state?.domain?.id\n const names = [...new Set(rows.map(row => row.values.name).filter((v): v is string => typeof v === 'string' && !!v.trim()).map(v => v.trim()))]\n const codes = [...new Set(rows.map(row => row.values.controlNo).filter((v): v is string => typeof v === 'string' && !!v.trim()).map(v => v.trim()))]\n if (!domainId || (!names.length && !codes.length)) return departmentIssues(rows, [])\n const [{ getRepository }, { Department }, { In }] = await Promise.all([import('@things-factory/shell'), import('../service/department/department'), import('typeorm')])\n const existing = await getRepository(Department).find({\n where: [\n ...(names.length ? [{ domain: { id: domainId }, name: In(names) }] : []),\n ...(codes.length ? [{ domain: { id: domainId }, controlNo: In(codes) }] : [])\n ] as any,\n select: ['id', 'name', 'controlNo'] as any\n })\n return departmentIssues(rows, existing)\n },\n\n update: {\n read: {\n query: DEPARTMENTS,\n variables: ids => ({ filters: [{ name: 'id', operator: 'in', value: ids }], pagination: { page: 1, limit: ids.length } }),\n recordsOf: data => data?.departments?.items ?? []\n },\n find: {\n query: DEPARTMENTS,\n variables: criteria => ({\n filters: ['name', 'controlNo'].filter(name => typeof criteria?.[name] === 'string' && criteria[name]).map(name => ({ name, operator: 'search', value: criteria[name] })),\n pagination: { page: 1, limit: 200 }\n }),\n recordsOf: (data, criteria) => matching(data?.departments?.items ?? [], criteria),\n criteria: [\n { name: 'name', type: 'string', description: 'a piece of the department name' },\n { name: 'controlNo', type: 'string', description: \"a piece of the department's 관리번호\" }\n ]\n },\n mutation: 'mutation ($id: String!, $patch: DepartmentPatch!) { updateDepartment(id: $id, patch: $patch) { id } }',\n variables: ({ id, values }) => ({ id, patch: inputOf(values, DEPARTMENT_UPDATE_FIELDS, ['parent']) }),\n labelOf: record => codeAndName(record),\n fields: DEPARTMENT_UPDATE_FIELDS,\n\n /*\n * A new name or 관리번호 another department has, and a parent the department's own rule refuses - asked through\n * `checkedParent` itself, which only reads: it walks up from the parent within the domain and throws.\n */\n check: async (rows, { state }) => {\n const domain = state?.domain\n if (!domain?.id) return departmentChangeIssues(rows, [])\n const given = (name: string) => [...new Set(rows.filter(row => name in row.values).map(row => row.values[name]).filter((v): v is string => typeof v === 'string' && !!v.trim()).map(v => v.trim()))]\n const [names, codes] = [given('name'), given('controlNo')]\n const [{ getRepository }, { Department }, { checkedParent }, { In }] = await Promise.all([\n import('@things-factory/shell'),\n import('../service/department/department'),\n import('../service/department/department-parent'),\n import('typeorm')\n ])\n const repository = getRepository(Department)\n const existing =\n names.length || codes.length\n ? await repository.find({\n where: [\n ...(names.length ? [{ domain: { id: domain.id }, name: In(names) }] : []),\n ...(codes.length ? [{ domain: { id: domain.id }, controlNo: In(codes) }] : [])\n ] as any,\n select: ['id', 'name', 'controlNo'] as any\n })\n : []\n const parents: ParentVerdict[] = []\n for (const row of rows) {\n const parentId = changedParentId(row.values)\n if (!parentId) {\n parents.push(undefined)\n continue\n }\n try {\n await checkedParent(row.id, { parent: { id: parentId } }, repository, domain)\n parents.push(undefined)\n } catch (error: any) {\n const verdict = parentVerdictOf(error)\n if (!verdict) throw error\n parents.push(verdict)\n }\n }\n return departmentChangeIssues(rows, existing as any, parents)\n }\n }\n }\n}\n\n/*\n * ── 직원 (employee) ──────────────────────────────────────────────────────────────────────────────────\n *\n * PERSONAL DATA. A row of this target is a person's name, position and hire day, and proposing it sends that\n * material to an external model. It is declared here so the shape is settled, and **no application opens it**:\n * a mode may name `organization.employee` only by an explicit product decision.\n *\n * Kept to the fields a roster needs. Never taken: user, bankAccount, bankName, emergencyContact,\n * emergencyContactPhone, contact, photo, supervisor. No update this round.\n *\n * The department is passed as an id the assistant resolved through the domain-scoped `departments` query, and\n * createEmployee looks it up again inside the caller's domain.\n */\nexport const EMPLOYEE_FORBIDDEN_FIELDS = ['user', 'bankAccount', 'bankName', 'emergencyContact', 'emergencyContactPhone', 'contact', 'photo', 'supervisor']\n\nconst EMPLOYEE_FIELDS: EntryField[] = [\n { name: 'controlNo', type: 'string', required: true, labelKey: 'field.control-no', description: 'the employee number (사번) as the material writes it' },\n { name: 'name', type: 'string', required: true, labelKey: 'field.name', description: \"the person's name\" },\n { name: 'jobPosition', type: 'string', labelKey: 'label.job-position', description: 'the rank (직급) - 사원, 대리, 과장...' },\n { name: 'jobResponsibility', type: 'string', labelKey: 'label.job-responsibility', description: 'the role (직책) - 팀장, 파트장...' },\n { name: 'type', type: 'enum', values: ['FULLTIME', 'PARTTIME', 'TEMPORARY'], labelKey: 'field.type', valueKeyPrefix: 'text.employee-type-' },\n { name: 'hiredOn', type: 'date', labelKey: 'field.hired-on', description: 'the day the person was hired' },\n { name: 'department', type: 'reference', labelKey: 'field.department', description: 'the department, by its name or 관리번호', reference: departmentReference }\n]\n\nexport function employeeEntryTarget(): EntryTargetDeclaration {\n return {\n key: ORGANIZATION_EMPLOYEE,\n labelKey: 'label.organization-entry-employee',\n description: 'one employee: the employee number (사번), the name, the rank and the role, the kind of employment, the day hired, and the department.',\n mutation: 'mutation ($employee: NewEmployee!) { createEmployee(employee: $employee) { id controlNo name } }',\n fields: EMPLOYEE_FIELDS,\n maxRows: 200,\n variables: (row: EntryRow) => ({ employee: inputOf(row.values, EMPLOYEE_FIELDS.map(field => field.name), ['department']) }),\n appliedOf: (data, row) => ({ id: data?.createEmployee?.id, label: codeAndName(data?.createEmployee ?? row.values) }),\n check: async (rows, { state }) => {\n const domainId = state?.domain?.id\n const codes = [...new Set(rows.map(row => row.values.controlNo).filter((v): v is string => typeof v === 'string' && !!v.trim()).map(v => v.trim()))]\n if (!domainId || !codes.length) return employeeIssues(rows, [])\n const [{ getRepository }, { Employee }, { In }] = await Promise.all([import('@things-factory/shell'), import('../service/employee/employee'), import('typeorm')])\n const existing = await getRepository(Employee).find({ where: { domain: { id: domainId }, controlNo: In(codes) } as any, select: ['id', 'controlNo'] as any })\n return employeeIssues(rows, existing)\n }\n }\n}\n\n/**\n * The organization's AI 입력 targets an application may register as a whole - the department. The employee is\n * left out on purpose: it is taken only by name, `employeeEntryTarget()`, after a product decision (see the note\n * above `EMPLOYEE_FORBIDDEN_FIELDS`), so registering this list never brings it along.\n */\nexport function organizationEntryTargets(): EntryTargetDeclaration[] {\n return [departmentEntryTarget()]\n}\n\n/**\n * The person's own career profile, from a résumé or a profile document they attach (ADR-0169 decision 10): the\n * assistant proposes its parts as rows, the card shows them against the file, and pressing adds them to the person's\n * own profile through `addToMyEmployeeProfile` - one call a section, nothing kept taken away. Only one's own: the door\n * finds the profile from the signed-in account and takes no person.\n */\nexport function employeeProfileEntryTarget(): EntryTargetDeclaration {\n return {\n key: ORGANIZATION_EMPLOYEE_PROFILE,\n labelKey: 'label.organization-entry-employee-profile',\n description:\n \"one part of the person's OWN career profile (내 프로필), read from a résumé or profile they attached or from what they said: the summary, one skill, one school, one certificate, one job before this company, or one project. Never another person's.\",\n mutation: 'mutation ($profile: EmployeeProfileInput!) { addToMyEmployeeProfile(profile: $profile) { id } }',\n fields: PROFILE_ENTRY_FIELDS,\n maxRows: 150,\n group: {\n by: 'section',\n variables: rows => ({ profile: profileAdditionOf(rows) }),\n appliedOf: (data, rows) => ({ id: data?.addToMyEmployeeProfile?.id, label: profileAppliedLabel(rows) })\n },\n check: rows => profileEntryIssues(rows)\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"register-employee-as-system-user.js","sourceRoot":"","sources":["../../server/controllers/register-employee-as-system-user.ts"],"names":[],"mappings":";;AAOA,oEA4CC;AAED,oEAsDC;AAED,oEAqCC;AAlJD,iDAAqD;AACrD,yDAAsD;AACtD,qDAAqE;AAErE,iEAA0D;AAGnD,KAAK,UAAU,4BAA4B,CAAC,UAAkB,EAAE,OAAwB;IAC7F,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;IAEpC,MAAM,kBAAkB,GAAG,IAAA,qBAAa,EAAC,sBAAQ,EAAE,EAAE,CAAC,CAAA;IAEtD,MAAM,QAAQ,GAAG,MAAM,kBAAkB,CAAC,OAAO,CAAC;QAChD,KAAK,EAAE;YACL,EAAE,EAAE,UAAU;YACd,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE;SAC1B;QACD,SAAS,EAAE,CAAC,SAAS,EAAE,MAAM,CAAC;KAC/B,CAAC,CAAA;IAEF,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC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EAAE,EAAE,EAAE,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE;YAC/B,SAAS,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC;SAChC,CAAC,CAAA;QAEF,MAAM,QAAQ,GAAG,MAAM,IAAA,qBAAa,EAAC,gBAAI,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC;YACrD,KAAK,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE;SAC9D,CAAC,CAAA;QAEF,IAAI,QAAQ,EAAE,CAAC;YACb,UAAU,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,QAAQ,CAAC,EAAE,CAAC,CAAA;YAC3E,UAAU,CAAC,OAAO,GAAG,IAAI,CAAA;YACzB,MAAM,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;QACvC,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["import { getRepository } from '@things-factory/shell'\nimport { Role, User } from '@things-factory/auth-base'\nimport { registerContactAsSystemUser } from '@things-factory/contact'\n\nimport { Employee } from '../service/employee/employee.js'\nimport { EmployeePatch } from '../service/employee/employee-type.js'\n\nexport async function registerEmployeeAsSystemUser(employeeId: string, context: ResolverContext) {\n const { domain, tx } = context.state\n\n const employeeRepository = getRepository(Employee, tx)\n\n const employee = await employeeRepository.findOne({\n where: {\n id: employeeId,\n domain: { id: domain.id }\n },\n relations: ['contact', 'user']\n })\n\n if (employee.user) {\n throw new Error(context.t('error.employee-already-registered'))\n }\n\n if (!employee.contact) {\n throw new Error(context.t('error.contact-information-required'))\n }\n\n /*\n * A role named as the employee's job responsibility comes along when the domain has one — as a job change swaps it\n * below. A domain's roles need not follow its job titles, and one that does not have such a role still registers\n * the employee; the roles are then given on the role screen.\n */\n const sameNamed =\n employee.active && employee.jobResponsibility\n ? await getRepository(Role, tx).findOne({ where: { name: employee.jobResponsibility, domain: { id: domain.id } } })\n : null\n\n const systemUser = await registerContactAsSystemUser(\n {\n contactId: employee.contact.id,\n roleName: sameNamed?.name\n },\n context\n )\n\n employee.user = systemUser\n\n await employeeRepository.save(employee)\n\n return systemUser\n}\n\nexport async function onUpdateEmployeeAsSystemUser(patch: EmployeePatch, context: ResolverContext) {\n const { domain, user, tx } = context.state\n const { id, jobResponsibility } = patch\n\n const employeeRepository = getRepository(Employee, tx)\n\n const employee = await employeeRepository.findOne({\n where: {\n id,\n domain: { id: domain.id }\n },\n relations: ['contact', 'user']\n })\n\n if (!employee.user) {\n return\n }\n\n const { jobResponsibility: lastJobResponsibility } = employee\n\n if ('jobResponsibility' in patch && lastJobResponsibility !== jobResponsibility) {\n const userRepository = getRepository(User, tx)\n\n const systemUser = await userRepository.findOne({\n where: { id: employee.user.id },\n relations: ['domains', 'roles']\n })\n\n const { roles } = systemUser\n let newRoles = [...roles]\n\n if (lastJobResponsibility) {\n const lastRole = await getRepository(Role, tx).findOne({\n where: { name: lastJobResponsibility, domain: { id: domain.id } }\n })\n\n if (lastRole) {\n newRoles = roles.filter(role => role.id !== lastRole.id)\n }\n }\n\n const newRole = await getRepository(Role, tx).findOne({\n where: { name: jobResponsibility, domain: { id: domain.id } }\n })\n\n if (newRole && !roles.find(role => role.id === newRole.id)) {\n newRoles = [...newRoles, newRole]\n }\n\n systemUser.roles = newRoles\n systemUser.updater = user\n\n await userRepository.save(systemUser)\n }\n}\n\nexport async function onDeleteEmployeeAsSystemUser(employeeId: string, context: ResolverContext) {\n const { domain, user, tx } = context.state\n\n const employeeRepository = getRepository(Employee, tx)\n\n const employee = await employeeRepository.findOne({\n where: {\n id: employeeId,\n domain: { id: domain.id }\n },\n relations: ['user']\n })\n\n if (!employee.user) {\n return\n }\n\n const { jobResponsibility } = employee\n\n if (jobResponsibility) {\n const userRepository = getRepository(User, tx)\n\n const systemUser = await userRepository.findOne({\n where: { id: employee.user.id },\n relations: ['domains', 'roles']\n })\n\n const lastRole = await getRepository(Role, tx).findOne({\n where: { name: jobResponsibility, domain: { id: domain.id } }\n })\n\n if (lastRole) {\n systemUser.roles = systemUser.roles.filter(role => role.id !== lastRole.id)\n systemUser.updater = user\n await userRepository.save(systemUser)\n }\n }\n}\n"]}
|
package/dist-server/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../server/index.ts"],"names":[],"mappings":";;;;AAAA,oDAAyB;AACzB,gFAAqD;AAGrD,oBAAiB;AACjB,yFAAoH;AAA3G,kIAAA,uBAAuB,OAAA;AAAE,sIAAA,2BAA2B,OAAA;AAE7D,yDAA4D;AAC5D,6CAAyC;AAEzC,KAAK,MAAM,IAAI,IAAI,uBAAU;IAAE,IAAA,4BAAgB,EAAC,IAAI,CAAC,CAAA;AACrD,wBAAqB","sourcesContent":["export * from './service'\nexport * from './ai-entry/organization-entry-targets'\nexport type { EntryTargetDeclaration as OrganizationEntryTarget } from './ai-entry/entry-target-shape'\n\nimport './routes'\nexport { CAREER_CERTIFICATE_KIND, EMPLOYMENT_CERTIFICATE_KIND } from './service/certificate/employment-certificates'\n\nimport { registerRoleTask } from '@things-factory/auth-base'\nimport { ROLE_TASKS } from './role-tasks'\n\nfor (const task of ROLE_TASKS) registerRoleTask(task)\nimport './work-doors'\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"1723861013111-seed-organization-codes.js","sourceRoot":"","sources":["../../server/migrations/1723861013111-seed-organization-codes.ts"],"names":[],"mappings":";;;AAEA,6CAA4C;AAC5C,iDAA6D;AAC7D,yDAAgD;AAChD,yDAAwE;AAExE,MAAM,iBAAiB,GAAG;IACxB;QACE,IAAI,EAAE,eAAe;QACrB,WAAW,EAAE,OAAO;QACpB,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,UAAU;gBAChB,WAAW,EAAE,SAAS;gBACtB,MAAM,EAAE,IAAI;gBACZ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C,EAAE;YACrD,IAAI,MAAM,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAA;YACtG,MAAM,IAAI,CAAC,MAAM,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAA;QAC7C,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AAxDD,gFAwDC","sourcesContent":["import { MigrationInterface, QueryRunner } from 'typeorm'\n\nimport { logger } from '@things-factory/env'\nimport { Domain, getRepository } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { CommonCode, CommonCodeDetail } from '@things-factory/code-base'\n\nconst SEED_COMMON_CODES = [\n {\n name: 'EMPLOYEE_TYPE',\n description: '직원 유형',\n details: [\n {\n name: 'FULLTIME',\n description: '풀타임 정규직',\n labels: null,\n rank: 1\n },\n {\n name: 'PARTTIME',\n description: '파트타임 정규직',\n labels: null,\n rank: 2\n },\n {\n name: 'TEMPORARY',\n description: '임시직',\n labels: null,\n rank: 3\n }\n ]\n },\n {\n name: 'JOB_POSITION',\n description: '직급',\n details: [\n // {\n // name: '임원',\n // description: '임원',\n // labels: null,\n // rank: 1\n // },\n // {\n // name: '직원',\n // description: '직원',\n // labels: null,\n // rank: 2\n // }\n ]\n },\n {\n name: 'JOB_RESPONSIBILITY',\n description: '직책',\n details: [\n // {\n // name: '상담사',\n // description: '상담사',\n // labels: null,\n // rank: 1\n // },\n // {\n // name: '매니저',\n // description: '매니저',\n // labels: null,\n // rank: 2\n // }\n ]\n }\n]\n\nexport class SeedOrganizationCodes1723861013111 implements MigrationInterface {\n public async up(queryRunner: QueryRunner): Promise<void> {\n const commonCodeRepository = getRepository(CommonCode)\n const commonCodeDetailRepository = getRepository(CommonCodeDetail)\n const domainRepository = getRepository(Domain)\n const userRepository = getRepository(User)\n\n const domain: Domain = await domainRepository.findOne({\n where: { name: 'SYSTEM' }\n })\n const user = await userRepository.findOne({ where: { id: domain.owner } })\n\n try {\n for (let i = 0; i < SEED_COMMON_CODES.length; i++) {\n const { name, description, details } = SEED_COMMON_CODES[i]\n\n const commonCode = await commonCodeRepository.save({\n domain,\n name,\n description,\n creator: user,\n updater: user\n })\n\n for (const commonCodeDetail of details) {\n const { name, description, labels, rank } = commonCodeDetail\n\n await commonCodeDetailRepository.save({\n domain,\n commonCode,\n name,\n description,\n labels,\n rank\n })\n }\n }\n } catch (e) {\n logger.error(e)\n }\n }\n\n public async down(queryRunner: QueryRunner): Promise<void> {\n const domainRepository = getRepository(Domain)\n\n const domain: Domain = await domainRepository.findOne({\n where: { name: 'SYSTEM' }\n })\n\n const repository = getRepository(CommonCode)\n\n SEED_COMMON_CODES.reverse().forEach(async commonCode => {\n let record = await repository.findOne({ where: { name: commonCode.name, domain: { id: domain.id } } })\n record && (await repository.remove(record))\n })\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/migrations/index.ts"],"names":[],"mappings":";;;AAAA,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;AAC5B,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;AAEjB,QAAA,UAAU,GAAG,EAAE,CAAA;AAE1B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,UAAS,IAAI;IACzE,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAAE,OAAM;IAC3C,kBAAU,GAAG,kBAAU,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAA;AAClF,CAAC,CAAC,CAAA","sourcesContent":["const glob = require('glob')\nconst path = require('path')\n\nexport var migrations = []\n\nglob.sync(path.resolve(__dirname, '.', '**', '*.js')).forEach(function(file) {\n if (file.indexOf('index.js') !== -1) return\n migrations = migrations.concat(Object.values(require(path.resolve(file))) || [])\n})\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"role-tasks.js","sourceRoot":"","sources":["../server/role-tasks.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAIU,QAAA,UAAU,GAAe;IACpC,EAAE,EAAE,EAAE,6BAA6B,EAAE,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE;IACvI,6HAA6H;IAC7H,EAAE,EAAE,EAAE,kCAAkC,EAAE,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE;IACjG,EAAE,EAAE,EAAE,6BAA6B,EAAE,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,OAAO,EAAE,UAAU,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,OAAO,EAAE,UAAU,CAAC,EAAE,CAAC,EAAE;IAC/J,EAAE,EAAE,EAAE,2BAA2B,EAAE,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAC,OAAO,EAAE,UAAU,CAAC,EAAE,CAAC,EAAE;IAC5G,+HAA+H;IAC/H,EAAE,EAAE,EAAE,0BAA0B,EAAE,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC,OAAO,EAAE,UAAU,CAAC,EAAE,CAAC,EAAE;IACxG,EAAE,EAAE,EAAE,+BAA+B,EAAE,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE;IACpG,4GAA4G;IAC5G,EAAE,EAAE,EAAE,mCAAmC,EAAE,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAE,sBAAsB,EAAE,IAAI,EAAE,CAAC,OAAO,EAAE,UAAU,CAAC,EAAE,CAAC,EAAE;CACzH,CAAA","sourcesContent":["/*\n * The work this module names, for the seats applications build (ADR-0139 decision 11).\n *\n * A task holds whole privileges: each opens everything its doors open, and the words under `task.<id>` in this\n * module's translations say what that is. Seats are put together by applications (`RoleTemplate.tasks`).\n *\n * Data only - `server/index.ts` registers it - so an application's tests read it without starting the framework.\n */\n\nimport type { RoleTask } from '@things-factory/auth-base'\n\nexport const ROLE_TASKS: RoleTask[] = [\n { id: 'organization.people-reading', grants: [{ category: 'employee', axes: ['query'] }, { category: 'department', axes: ['query'] }] },\n /* The departments alone, for every seat that picks or shows one; `manager` and `members` still ask `employee` (ADR-0139). */\n { id: 'organization.departments-reading', grants: [{ category: 'department', axes: ['query'] }] },\n { id: 'organization.people-keeping', grants: [{ category: 'employee', axes: ['query', 'mutation'] }, { category: 'department', axes: ['query', 'mutation'] }] },\n { id: 'organization.pay-accounts', grants: [{ category: 'employee-private', axes: ['query', 'mutation'] }] },\n /* One's own profile, written by the employee; every active employee's, read to attach to a quotation (ADR-0169 decision 3). */\n { id: 'organization.own-profile', grants: [{ category: 'employee-self', axes: ['query', 'mutation'] }] },\n { id: 'organization.profiles-reading', grants: [{ category: 'employee-profile', axes: ['query'] }] },\n /* 재직증명서 · 경력증명서 of others, and every 경력증명서 - one's own 재직증명서 is `employee-self`'s (ADR-0176 decision 5). */\n { id: 'organization.certificates-issuing', grants: [{ category: 'employee-certificate', axes: ['query', 'mutation'] }] }\n]\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../server/routes.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,EAAE,CAAC,sCAA6C,EAAE,CAAC,GAAG,EAAE,kBAAkB,EAAE,EAAE;IACpF;;;;;OAKG;AACL,CAAC,CAAC,CAAA;AAEF,OAAO,CAAC,EAAE,CAAC,uCAA8C,EAAE,CAAC,GAAG,EAAE,mBAAmB,EAAE,EAAE;IACtF;;OAEG;AACL,CAAC,CAAC,CAAA;AAEF,OAAO,CAAC,EAAE,CAAC,sCAA6C,EAAE,CAAC,GAAG,EAAE,kBAAkB,EAAE,EAAE;IACpF;;OAEG;AACL,CAAC,CAAC,CAAA;AAEF,OAAO,CAAC,EAAE,CAAC,uCAA8C,EAAE,CAAC,GAAG,EAAE,mBAAmB,EAAE,EAAE;IACtF;;OAEG;AACL,CAAC,CAAC,CAAA","sourcesContent":["process.on('bootstrap-module-global-public-route' as any, (app, globalPublicRouter) => {\n /*\n * can add global public routes to application (auth not required, tenancy not required)\n *\n * ex) routes.get('/path', async(context, next) => {})\n * ex) routes.post('/path', async(context, next) => {})\n */\n})\n\nprocess.on('bootstrap-module-global-private-route' as any, (app, globalPrivateRouter) => {\n /*\n * can add global private routes to application (auth required, tenancy not required)\n */\n})\n\nprocess.on('bootstrap-module-domain-public-route' as any, (app, domainPublicRouter) => {\n /*\n * can add domain public routes to application (auth not required, tenancy required)\n */\n})\n\nprocess.on('bootstrap-module-domain-private-route' as any, (app, domainPrivateRouter) => {\n /*\n * can add domain private routes to application (auth required, tenancy required)\n */\n})\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
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,w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AE,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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"approval-line-mutation.js","sourceRoot":"","sources":["../../../server/service/approval-line/approval-line-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAqF;AACrF,+DAA8D;AAC9D,qCAA4B;AAE5B,iDAA6E;AAC7E,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,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAA;YACtG,MAAK;QACP,QAAQ;IACV,CAAC;IAED,OAAO,WAAW,EAAE,EAAE,IAAI,IAAI,CAAA;AAChC,CAAC;AAED,SAAS,aAAa,CAAC,KAA0C;IAC/D,IAAI,CAAC,CAAC,OAAO,IAAI,KAAK,CAAC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phql'\nimport { requireMyEmployee } from '../employee/my-employee.js'\nimport { In } from 'typeorm'\n\nimport { getRepository, Refusal, SpeakRefusals } 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 .map((m, index) => {\n /* A step that names its person - an employee, a department, a role - and names none is refused, not dropped. */\n switch (m.type) {\n case OrgMemberTargetType.Employee:\n case OrgMemberTargetType.Department:\n case OrgMemberTargetType.Role:\n if (!m.approver?.id)\n throw new Refusal('approval-line-approver-required', { row: index + 1 }, `row ${index + 1}: choose the approver`)\n }\n return m\n })\n}\n\n@Resolver(ApprovalLine)\n@UseMiddleware(SpeakRefusals)\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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"approval-line-query.js","sourceRoot":"","sources":["../../../server/service/approval-line/approval-line-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAC9F,+DAA0D;AAC1D,qCAAsC;AACtC,iDAAuG;AACvG,yDAAsD;AACtD,6DAA4E;AAC5E,mDAAwF;AACxF,6DAAuD;AACvD,mDAA+C;AAC/C,yDAAqD;AAErD,KAAK,UAAU,aAAa,CAAC,YAA0B,EAAE,OAAwB;IAC/E,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;IAChC,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,YAAY,CAAA;IAE9C,IAAI,CAAC,SAAS,IAAI,CAAC,UAAU,EAAE,CAAC;QAC9B,kDAAkD;QAClD,OAAO,IAAI,CAAA;IACb,CAAC;IAED,IAAI,WAAW,CAAA;IAEf,QAAQ,SAAS,EAAE,CAAC;QAClB,KAAK,qCAAqB,CAA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C,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAe,4BAAY;;+CAE9C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAe,4BAAY;;gDAE/C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAe,4BAAY;;gDAE/C;4BArIU,iBAAiB;IAD7B,IAAA,uBAAQ,EAAC,4BAAY,CAAC;GACV,iBAAiB,CAsI7B","sourcesContent":["import { Directive, Resolver, Query, FieldResolver, Root, Args, Arg, Ctx } from 'type-graphql'\nimport { myEmployeeIds } from '../employee/my-employee.js'\nimport { Brackets, In } from 'typeorm'\nimport { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'\nimport { Role, User } from '@things-factory/auth-base'\nimport { ApprovalLineItem, OrgMemberTargetType } from './approval-line-item'\nimport { ApprovalLine, ApprovalLineOwner, ApprovalLineOwnerType } from './approval-line'\nimport { ApprovalLineList } from './approval-line-type'\nimport { Employee } from '../employee/employee'\nimport { Department } from '../department/department'\n\nasync function getOwnerValue(approvalLine: ApprovalLine, context: ResolverContext) {\n const { domain } = context.state\n const { ownerType, ownerValue } = approvalLine\n\n if (!ownerType || !ownerValue) {\n /* ownerType이 클리어되거나, owner가 지정되지 않았다면, 클리어시킨다. */\n return null\n }\n\n var ownerObject\n\n switch (ownerType) {\n case ApprovalLineOwnerType.Employee:\n ownerObject = await getRepository(Employee).findOneBy({ domain: { id: domain.id }, id: ownerValue })\n break\n default:\n return null\n }\n\n return ownerObject\n}\n\nasync function getModel(approvalLine: ApprovalLine, context: ResolverContext): Promise<ApprovalLineItem[]> {\n const { domain } = context.state\n const { model } = approvalLine\n\n if (!model || !(model instanceof Array)) {\n return null\n }\n\n var approvalLineItemList = []\n\n for (let item of model) {\n /* deprecated \"value\", use approver */\n var { type, value, approver, participation, notifyAfter } = item\n var id = approver?.id || value\n approver = null\n\n switch (type) {\n case OrgMemberTargetType.Employee:\n approver = id && (await getRepository(Employee).findOneBy({ domain: { id: domain.id }, id }))\n break\n case OrgMemberTargetType.Department:\n approver = id && (await getRepository(Department).findOneBy({ domain: { id: domain.id }, id }))\n break\n case OrgMemberTargetType.Role:\n approver = id && (await getRepository(Role).findOneBy({ domain: { id: domain.id }, id }))\n break\n case OrgMemberTargetType.Myself:\n case OrgMemberTargetType.MyDepartment:\n case OrgMemberTargetType.MySupervisor:\n break\n default:\n continue\n }\n\n /*\n * ── 같은 결함이 세 겹이었다 ──────────────────────────────────────────────\n * 결재선 항목의 칸을 하나씩 옮겨 적는 자리가 셋이고, 셋 다 `{ type, approver }` 만 알았다.\n *\n * 화면 편집기 값을 모을 때 고쳐도 저장되지 않았다\n * 서버 쓰기 getModelValue 저장할 때 버렸다\n * 서버 읽기 여기 저장된 것을 읽을 때 버렸다\n *\n * 그래서 앞의 둘을 고친 뒤에도 읽으면 여전히 `null` 이었다. **한 겹만 고치면 고쳐진 것으로\n * 보이지 않고, 세 겹을 다 고쳐야 비로소 값이 산다.**\n *\n * `ApprovalLineItem` 에 칸을 더하면 이 셋을 함께 고쳐야 한다. 어느 하나를 빼먹으면 오류 없이\n * 값만 사라진다 — 화면에서는 고쳐지고, 다시 읽으면 없다.\n */\n approvalLineItemList.push({ type, approver, participation, notifyAfter })\n }\n\n return approvalLineItemList\n}\n\n@Resolver(ApprovalLine)\nexport class ApprovalLineQuery {\n @Query(returns => ApprovalLine!, { nullable: true, description: 'To fetch a approval line' })\n async approvalLine(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<ApprovalLine> {\n const { domain } = context.state\n\n return await getRepository(ApprovalLine).findOne({\n where: { domain: { id: domain.id }, id }\n })\n }\n\n @Directive('@privilege(category: \"organization\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(returns => ApprovalLineList, { description: 'To fetch multiple approval lines' })\n async approvalLines(\n @Args(type => ListParam) params: ListParam,\n @Ctx() context: ResolverContext\n ): Promise<ApprovalLineList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(ApprovalLine),\n searchables: ['name', 'description']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @Query(returns => ApprovalLineList, { description: 'To fetch referable approval lines for the user' })\n async approvalLineReferences(\n @Args(type => ListParam) params: ListParam,\n @Ctx() context: ResolverContext\n ): Promise<ApprovalLineList> {\n const { domain } = context.state\n /* 「이 사용자의 사원」을 여기서 다시 읽지 않는다 — 판정은 한 자리다(§`my-employee.ts`). */\n const mine = await myEmployeeIds(context)\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(ApprovalLine),\n searchables: ['name', 'description']\n }).andWhere(\n mine.length\n ? new Brackets(qb => {\n qb.where({ ownerType: 'Common' })\n qb.orWhere({ ownerType: 'Employee', ownerValue: In(mine) })\n })\n : { ownerType: 'Common' }\n )\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @Query(returns => ApprovalLineList, { description: 'To fetch approval lines only for to the user' })\n async myApprovalLines(\n @Args(type => ListParam) params: ListParam,\n @Ctx() context: ResolverContext\n ): Promise<ApprovalLineList> {\n const { domain } = context.state\n const mine = await myEmployeeIds(context)\n\n /*\n * **사원 기록이 없으면 그 자리에서 빈 목록이다.** 예전에는 `In([])` 을 그대로 넘겼다 — 결과는\n * 같았지만 빈 배열을 `In` 에 넣었을 때 드라이버마다 무엇이 나가는지에 기대고 있었다. 옆의\n * `approvalLineReferences` 는 같은 경우를 명시적으로 갈랐다. 같은 파일에서 같은 사실을 두\n * 방식으로 다루면, 한쪽만 고쳐지는 날이 온다.\n *\n * 그리고 **오류를 내지 않는다.** 이 목록의 참인 답이 0건이다. 「너는 이 화면을 쓸 수 없다」는\n * 자격에 대한 물음이고, 그것은 목록이 아니라 사원 기록을 묻는 자리가 답한다.\n */\n if (!mine.length) return { items: [], total: 0 }\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(ApprovalLine),\n searchables: ['name', 'description']\n }).andWhere({ ownerType: 'Employee', ownerValue: In(mine) })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @Query(returns => ApprovalLineList, { description: 'To fetch common approval lines' })\n async commonApprovalLines(\n @Args(type => ListParam) params: ListParam,\n @Ctx() context: ResolverContext\n ): Promise<ApprovalLineList> {\n const { domain, user } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(ApprovalLine),\n searchables: ['name', 'description']\n }).andWhere({\n ownerType: 'Common'\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @FieldResolver(type => [ApprovalLineItem])\n async model(@Root() approvalLine: ApprovalLine, @Ctx() context: ResolverContext): Promise<ApprovalLineItem[]> {\n return await getModel(approvalLine, context)\n }\n\n @FieldResolver(type => ApprovalLineOwner)\n async owner(@Root() approvalLine: ApprovalLine, @Ctx() context: ResolverContext): Promise<ApprovalLineOwner> {\n return await getOwnerValue(approvalLine, context)\n }\n\n @FieldResolver(type => Domain)\n async domain(@Root() approvalLine: ApprovalLine): Promise<Domain> {\n return await getRepository(Domain).findOneBy({ id: approvalLine.domainId })\n }\n\n @FieldResolver(type => User)\n async updater(@Root() approvalLine: ApprovalLine): Promise<User> {\n return await getRepository(User).findOneBy({ id: approvalLine.updaterId })\n }\n\n @FieldResolver(type => User)\n async creator(@Root() approvalLine: ApprovalLine): Promise<User> {\n return await getRepository(User).findOneBy({ id: approvalLine.creatorId })\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"approval-line-type.js","sourceRoot":"","sources":["../../../server/service/approval-line/approval-line-type.ts"],"names":[],"mappings":";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;;oDACxB;AAGjC;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,8BAA8B,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCAC1D,8BAA8B;gDAAA;AAGtC;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,oBAAY,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACtB;AAG1B;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDACX;4BApBJ,iBAAiB;IAD7B,IAAA,wBAAS,GAAE;GACC,iBAAiB,CAqB7B;AAGM,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CAM5B,CAAA;AANY,4CAAgB;AAE3B;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,4BAAY,CAAC,CAAC;;+CACT;AAGrB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;+CACN;2BALF,gBAAgB;IAD5B,IAAA,yBAAU,GAAE;GACA,gBAAgB,CAM5B","sourcesContent":["import { ObjectType, Field, InputType, Int, ID } from 'type-graphql'\n\nimport { ObjectRef, ScalarObject } from '@things-factory/shell'\n\nimport { ApprovalLine, ApprovalLineOwnerType } from './approval-line'\nimport { ApprovalLineItem } from './approval-line-item'\n\n@InputType()\nexport class ObjectRefApprovalLineOwnerType extends ObjectRef {\n @Field({ nullable: true })\n controlNo?: string\n}\n\n@InputType()\nexport class NewApprovalLine {\n @Field()\n name: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field(type => ApprovalLineOwnerType)\n ownerType: ApprovalLineOwnerType\n\n @Field(type => ObjectRefApprovalLineOwnerType)\n owner: ObjectRefApprovalLineOwnerType\n\n @Field(type => ScalarObject, { nullable: true })\n model?: ApprovalLineItem[]\n}\n\n@InputType()\nexport class ApprovalLinePatch {\n @Field(type => ID, { nullable: true })\n id?: string\n\n @Field({ nullable: true })\n name?: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field(type => ApprovalLineOwnerType, { nullable: true })\n ownerType?: ApprovalLineOwnerType\n\n @Field(type => ObjectRefApprovalLineOwnerType, { nullable: true })\n owner?: ObjectRefApprovalLineOwnerType\n\n @Field(type => ScalarObject, { nullable: true })\n model?: ApprovalLineItem[]\n\n @Field({ nullable: true })\n cuFlag?: string\n}\n\n@ObjectType()\nexport class ApprovalLineList {\n @Field(type => [ApprovalLine])\n items: ApprovalLine[]\n\n @Field(type => Int)\n total: number\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"approval-line.js","sourceRoot":"","sources":["../../../server/service/approval-line/approval-line.ts"],"names":[],"mappings":";;;;AAAA,qCAWgB;AAChB,+CAAsF;AAEtF,iDAAyD;AACzD,yDAAsD;AAEtD,6DAAuD;AACvD,mDAA+C;AAG/C,+DAAoC;AAEpC,IAAY,qBAGX;AAHD,WAAY,qBAAqB;IAC/B,8CAAqB,CAAA;IACrB,0CAAiB,CAAA;AACnB,CAAC,EAHW,qBAAqB,qCAArB,qBAAqB,QAGhC;AAED,IAAA,+BAAgB,EAAC,qBAAqB,EAAE;IACtC,IAAI,EAAE,uBAAuB;IAC7B,WAAW,EAAE,yCAAyC;CACvD,CAAC,CAAA;AAGK,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;CAY7B,CAAA;AAZY,8CAAiB;AAE5B;IADC,IAAA,oBAAK,EAAC,GAAG,EAAE,CAAC,iBAAE,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC;;6CACnC;AAGV;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,YAAY,EAAE,CAAC;;+CACxC;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,mBAAmB,EAAE,CAAC;;sDACxC;AAGpB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,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0B,EAAE,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC;;+CAC/C;uBA3DP,YAAY;IAdxB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EACJ,oBAAoB,EACpB,CAAC,YAA0B,EAAE,EAAE,CAAC;QAC9B,YAAY,CAAC,MAAM;QACnB,YAAY,CAAC,SAAS;QACtB,YAAY,CAAC,UAAU;QACvB,YAAY,CAAC,IAAI;KAClB,EACD;QACE,MAAM,EAAE,IAAI;KACb,CACF;IACA,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,yBAAyB,EAAE,CAAC;GAC1C,YAAY,CA4DxB","sourcesContent":["import {\n CreateDateColumn,\n UpdateDateColumn,\n DeleteDateColumn,\n Entity,\n Index,\n Column,\n RelationId,\n ManyToOne,\n PrimaryGeneratedColumn,\n VersionColumn\n} from 'typeorm'\nimport { InputType, ObjectType, Field, Int, ID, registerEnumType } from 'type-graphql'\n\nimport { Domain, ObjectRef } from '@things-factory/shell'\nimport { Role, User } from '@things-factory/auth-base'\n\nimport { ApprovalLineItem } from './approval-line-item'\nimport { Employee } from '../employee/employee'\nimport { Department } from '../department/department'\n\nexport * from './approval-line-item'\n\nexport enum ApprovalLineOwnerType {\n Employee = 'Employee',\n Common = 'Common'\n}\n\nregisterEnumType(ApprovalLineOwnerType, {\n name: 'ApprovalLineOwnerType',\n description: 'type enumeration of a approvalLineOwner'\n})\n\n@ObjectType()\nexport class ApprovalLineOwner {\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@Entity()\n@Index(\n 'ix_approval_line_0',\n (approvalLine: ApprovalLine) => [\n approvalLine.domain,\n approvalLine.ownerType,\n approvalLine.ownerValue,\n approvalLine.name\n ],\n {\n unique: true\n }\n)\n@ObjectType({ description: 'Entity for ApprovalLine' })\nexport class ApprovalLine {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @ManyToOne(type => Domain)\n @Field(type => Domain)\n domain?: Domain\n\n @RelationId((approvalLine: ApprovalLine) => approvalLine.domain)\n domainId?: 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 @Column('simple-json', { nullable: true })\n @Field(type => [ApprovalLineItem], { nullable: true })\n model?: ApprovalLineItem[]\n\n @Column({ nullable: true, length: 20 })\n @Field({ nullable: true })\n ownerType?: ApprovalLineOwnerType\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n ownerValue?: string\n\n @ManyToOne(type => Employee, employee => employee.approvalLines, { nullable: true })\n @Field({ nullable: true })\n ownerEmployee?: Employee\n\n @Field(type => ApprovalLineOwner, { nullable: true })\n owner?: ApprovalLineOwner\n\n @CreateDateColumn()\n @Field({ nullable: true })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true })\n updatedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n creator?: User\n\n @RelationId((approvalLine: ApprovalLine) => approvalLine.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((approvalLine: ApprovalLine) => approvalLine.updater)\n updaterId?: string\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/approval-line/index.ts"],"names":[],"mappings":";;;AAAA,mDAA8C;AAC9C,+DAAyD;AACzD,qEAA+D;AAElD,QAAA,QAAQ,GAAG,CAAC,4BAAY,CAAC,CAAA;AACzB,QAAA,SAAS,GAAG,CAAC,uCAAiB,EAAE,6CAAoB,CAAC,CAAA;AACrD,QAAA,WAAW,GAAG,EAAE,CAAA","sourcesContent":["import { ApprovalLine } from './approval-line'\nimport { ApprovalLineQuery } from './approval-line-query'\nimport { ApprovalLineMutation } from './approval-line-mutation'\n\nexport const entities = [ApprovalLine]\nexport const resolvers = [ApprovalLineQuery, ApprovalLineMutation]\nexport const subscribers = []\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"audience-member.js","sourceRoot":"","sources":["../../../server/service/audience/audience-member.ts"],"names":[],"mappings":";;AAiBA,sCAKC;AAGD,4CAGC;AAMD,4CAiBC;AAOD,0CAsBC;AAhFD;;;GAGG;AACH,qCAA2C;AAE3C,yDAAoE;AACpE,iDAA+G;AAE/G,yDAAqD;AACrD,mDAA+C;AAC/C,yCAA6H;AAE7H;;;GAGG;AACI,KAAK,UAAU,aAAa,CAAC,MAAuB,EAAE,MAAe,EAAE,EAAkB;IAC9F,MAAM,EAAE,GAAG,IAAA,qBAAa,EAAC,gBAAI,EAAE,EAAE,CAAC,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAA;IAC7D,IAAI,MAAM;QAAE,EAAE,CAAC,SAAS,CAAC,YAAY,EAAE,QAAQ,EAAE,qBAAqB,EAAE,EAAE,MAAM,EAAE,CAAC,CAAA;IACnF,IAAA,oCAA4B,EAAC,EAAE,EAAE,MAAM,EAAE,MAAa,EAAE,0BAAkB,CAAC,OAAO,CAAC,CAAA;IACnF,OAAO,MAAM,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,OAAO,EAAE,CAAA;AAChD,CAAC;AAED,0DAA0D;AACnD,KAAK,UAAU,gBAAgB,CAAC,MAAuB,EAAE,EAAkB;IAChF,MAAM,IAAI,GAAG,MAAM,IAAA,qBAAa,EAAC,uBAAU,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAS,EAAE,SAAS,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;IAC7H,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GA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AA;IACzF,CAAC;IAED,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAA;AACnD,CAAC","sourcesContent":["/*\n * The facts an audience is asked about, read from the domain (ADR-0163 decision 2) - who one person is to an audience,\n * and who the people of an audience are. The rule itself is audience.ts.\n */\nimport { EntityManager, In } from 'typeorm'\n\nimport { getDomainAssignees, Role } from '@things-factory/auth-base'\nimport { applyDomainInheritanceFilter, Domain, getRepository, InheritedValueType } from '@things-factory/shell'\n\nimport { Department } from '../department/department'\nimport { Employee } from '../employee/employee'\nimport { type AudienceMember, type AudienceTarget, departmentsOfEmployees, withAncestors, withDescendants } from './audience'\n\n/**\n * The roles of the domain - the ones it inherits from its parent included, as its privileges are\n * (User.getPrivilegesByDomain); `holder` keeps those one person holds.\n */\nexport async function domainRolesOf(domain: Partial<Domain>, holder?: string, tx?: EntityManager): Promise<Role[]> {\n const qb = getRepository(Role, tx).createQueryBuilder('ROLE')\n if (holder) qb.innerJoin('ROLE.users', 'HOLDER', 'HOLDER.id = :holder', { holder })\n applyDomainInheritanceFilter(qb, 'ROLE', domain as any, InheritedValueType.Include)\n return await qb.orderBy('ROLE.name').getMany()\n}\n\n/** Each department of the domain and the one above it. */\nexport async function departmentTreeOf(domain: Partial<Domain>, tx?: EntityManager): Promise<Map<string, string | null>> {\n const rows = await getRepository(Department, tx).find({ where: { domain: { id: domain.id } } as any, relations: ['parent'] })\n return new Map(rows.map(one => [one.id, one.parent?.id ?? null]))\n}\n\n/**\n * One person as an audience sees them, with the departments of their own active records (`ownDepartments`, what they\n * may address as theirs) apart from the ones above those.\n */\nexport async function audienceMemberOf(\n domain: Partial<Domain>,\n user: { id?: string },\n tx?: EntityManager\n): Promise<AudienceMember & { ownDepartments: { id: string; name: string }[] }> {\n if (!domain?.id || !user?.id) return { userId: user?.id, domainId: domain?.id, departmentIds: [], roleIds: [], ownDepartments: [] }\n const records = await getRepository(Employee, tx).find({ where: { domain: { id: domain.id }, user: { id: user.id }, active: true } as any, relations: ['department'] })\n const own = departmentsOfEmployees(records)\n const departmentIds = own.length ? withAncestors(own, await departmentTreeOf(domain, tx)) : []\n const roleIds = (await domainRolesOf(domain, user.id, tx)).map(one => one.id)\n return {\n userId: user.id,\n domainId: domain.id,\n departmentIds,\n roleIds,\n ownDepartments: own.map(id => ({ id, name: records.find(one => one.department?.id === id)?.department?.name ?? id }))\n }\n}\n\n/**\n * The people an audience names: those who may be given work in the domain (its active members and owners -\n * getDomainAssignees), narrowed to the targets. A department names the active employees of it and of every department\n * under it; a role, whoever holds it.\n */\nexport async function audienceUserIds(domain: Partial<Domain>, targets: readonly AudienceTarget[], tx?: EntityManager): Promise<string[]> {\n if (!domain?.id || !targets?.length) return []\n const assignees = new Set((await getDomainAssignees(domain as any, tx)).map(one => one.id))\n if (targets.some(one => one.scope === 'DOMAIN' && one.targetId === domain.id)) return [...assignees]\n\n const named = new Set<string>()\n for (const one of targets) if (one.scope === 'USER') named.add(one.targetId)\n\n const departments = targets.filter(one => one.scope === 'DEPARTMENT').map(one => one.targetId)\n if (departments.length) {\n const ids = withDescendants(departments, await departmentTreeOf(domain, tx))\n const employees = await getRepository(Employee, tx).find({ where: { domain: { id: domain.id }, department: { id: In(ids) }, active: true } as any, relations: ['user'] })\n for (const one of employees) if (one.user?.id) named.add(one.user.id)\n }\n\n const roles = targets.filter(one => one.scope === 'ROLE').map(one => one.targetId)\n if (roles.length) {\n const holders = await getRepository(Role, tx).createQueryBuilder('ROLE').innerJoinAndSelect('ROLE.users', 'HOLDER').where('ROLE.id IN (:...roles)', { roles }).getMany()\n for (const role of holders) for (const holder of role.users ?? []) named.add(holder.id)\n }\n\n return [...named].filter(id => assignees.has(id))\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"audience.js","sourceRoot":"","sources":["../../../server/service/audience/audience.ts"],"names":[],"mappings":";AAAA;;;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AqB,CACnC,MAAsB,EACtB,MAA0F;IAE1F,IAAI,CAAE,uBAAqC,CAAC,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC;QAAE,OAAO,eAAe,CAAA;IAC3F,IAAI,CAAC,MAAM,CAAC,QAAQ;QAAE,OAAO,WAAW,CAAA;IACxC,IAAI,MAAM,CAAC,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,KAAK,MAAM,CAAC,QAAQ;QAAE,OAAO,gBAAgB,CAAA;IAC7F,IAAI,MAAM,CAAC,KAAK,KAAK,YAAY,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC;QAAE,OAAO,oBAAoB,CAAA;IACjH,IAAI,MAAM,CAAC,KAAK,KAAK,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC;QAAE,OAAO,cAAc,CAAA;IAC/F,OAAO,SAAS,CAAA;AAClB,CAAC","sourcesContent":["/*\n * Whom a thing is addressed to in a domain - the one rule of an audience (ADR-0163 decision 2, ADR-0160 decision 7).\n *\n * An audience is a list of targets: the whole domain, a department (and every department under it), a role (the ones\n * the domain inherits included) or a person. A dashboard card shared and an announcement addressed ask the same\n * question, so they ask it here (the user, 2026-10-26: one rule, a department reaches its sub-departments).\n *\n * Pure - the rule is tested without a database. audience-member.ts reads the facts it is given.\n */\n\nexport const AUDIENCE_SCOPES = ['DOMAIN', 'DEPARTMENT', 'ROLE', 'USER'] as const\n\nexport type AudienceScope = (typeof AUDIENCE_SCOPES)[number]\n\nexport interface AudienceTarget {\n scope: AudienceScope | string\n targetId: string\n}\n\n/** One person as an audience sees them. */\nexport interface AudienceMember {\n userId: string\n domainId: string\n /**\n * The departments the person stands in: those of their active employee records and every department above them - a\n * department target reaches the people of the departments under it.\n */\n departmentIds: readonly string[]\n /** The roles the person holds in the domain, the inherited ones included. */\n roleIds: readonly string[]\n}\n\n/** Whether any of `targets` names `member`. */\nexport function audienceReaches(targets: readonly AudienceTarget[], member: AudienceMember): boolean {\n if (!member?.userId || !member.domainId) return false\n return (targets ?? []).some(\n target =>\n (target.scope === 'DOMAIN' && target.targetId === member.domainId) ||\n (target.scope === 'USER' && target.targetId === member.userId) ||\n (target.scope === 'DEPARTMENT' && member.departmentIds.includes(target.targetId)) ||\n (target.scope === 'ROLE' && member.roleIds.includes(target.targetId))\n )\n}\n\n/**\n * The departments of a person's employee records that are active (`active = true`; an unset `active` is not taken, as\n * the assistant's people read takes only `active eq true`). A record without a department adds none.\n */\nexport function departmentsOfEmployees(records: readonly { active?: boolean | null; department?: { id?: string | null } | null }[] | null | undefined): string[] {\n return [...new Set((records ?? []).filter(one => one?.active === true && one.department?.id).map(one => one.department!.id!))]\n}\n\n/** `departmentIds` and every department above them. A loop in the tree ends the walk instead of hanging it. */\nexport function withAncestors(departmentIds: readonly string[], parentOf: ReadonlyMap<string, string | null | undefined>): string[] {\n const out = new Set<string>()\n for (const start of departmentIds) {\n let id: string | null | undefined = start\n while (id && !out.has(id)) {\n out.add(id)\n id = parentOf.get(id)\n }\n }\n return [...out]\n}\n\n/** `departmentIds` and every department under them. */\nexport function withDescendants(departmentIds: readonly string[], parentOf: ReadonlyMap<string, string | null | undefined>): string[] {\n const children = new Map<string, string[]>()\n for (const [id, parent] of parentOf) if (parent) children.set(parent, [...(children.get(parent) ?? []), id])\n const out = new Set<string>()\n const walk = (id: string) => {\n if (out.has(id)) return\n out.add(id)\n for (const child of children.get(id) ?? []) walk(child)\n }\n departmentIds.forEach(walk)\n return [...out]\n}\n\n/**\n * Why a target may not be given, or nothing - a known scope with a target; the domain scope names the giver's own\n * domain, a department one of the domain's departments, a role one of the domain's roles.\n */\nexport function audienceTargetRefusal(\n target: AudienceTarget,\n domain: { domainId: string; departmentIds: readonly string[]; roleIds: readonly string[] }\n): string | undefined {\n if (!(AUDIENCE_SCOPES as readonly string[]).includes(target?.scope)) return 'unknown-scope'\n if (!target.targetId) return 'no-target'\n if (target.scope === 'DOMAIN' && target.targetId !== domain.domainId) return 'another-domain'\n if (target.scope === 'DEPARTMENT' && !domain.departmentIds.includes(target.targetId)) return 'unknown-department'\n if (target.scope === 'ROLE' && !domain.roleIds.includes(target.targetId)) return 'unknown-role'\n return undefined\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"employment-certificate-rules.js","sourceRoot":"","sources":["../../../server/service/certificate/employment-certificate-rules.ts"],"names":[],"mappings":";;AAmBA,kDAGC;AAGD,gDAEC;AAoBD,4CAeC;AA9DD,iDAA+C;AAkB/C,8GAA8G;AAC9G,SAAgB,mBAAmB,CAAC,IAAY,EAAE,QAA6B;IAC7E,IAAI,QAAQ,CAAC,OAAO;QAAE,OAAO,IAAI,CAAA;IACjC,OAAO,IAAI,KAAK,qCAAqC,IAAI,QAAQ,CAAC,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAA;AACxF,CAAC;AAED,+EAA+E;AAC/E,SAAgB,kBAAkB,CAAC,QAA6B;IAC9D,OAAO,QAAQ,CAAC,OAAO,IAAI,QAAQ,CAAC,OAAO,IAAI,QAAQ,CAAC,GAAG,CAAA;AAC7D,CAAC;AAcD,MAAM,GAAG,GAAG,CAAC,KAAc,EAAE,EAAE,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,YAAY,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;AAEhJ;;;GAGG;AACH,SAAgB,gBAAgB,CAAC,IAAY,EAAE,QAAgL,EAAE,KAAa;IAC5O,MAAM,OAAO,GAAG,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;IACrC,MAAM,SAAS,GAAG,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAA;IACzC,IAAI,CAAC,OAAO;QAAE,MAAM,IAAI,eAAO,CAAC,8BAA8B,EAAE,EAAE,EAAE,2BAA2B,CAAC,CAAA;IAChG,MAAM,OAAO,GAAG,CAAC,SAAS,IAAI,SAAS,IAAI,KAAK,CAAA;IAChD,IAAI,IAAI,KAAK,qCAAqC,IAAI,CAAC,OAAO;QAAE,MAAM,IAAI,eAAO,CAAC,0BAA0B,EAAE,EAAE,EAAE,mDAAmD,CAAC,CAAA;IACtK,OAAO;QACL,IAAI,EAAE,QAAQ,CAAC,IAAI,IAAI,EAAE;QACzB,UAAU,EAAE,QAAQ,CAAC,UAAU,EAAE,IAAI,IAAI,EAAE;QAC3C,WAAW,EAAE,QAAQ,CAAC,WAAW,IAAI,EAAE;QACvC,iBAAiB,EAAE,QAAQ,CAAC,iBAAiB,IAAI,EAAE;QACnD,OAAO;QACP,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;QAClC,OAAO;KACR,CAAA;AACH,CAAC","sourcesContent":["import { Refusal } from '@things-factory/shell'\n\n/*\n * Who may issue and read a 재직증명서 · 경력증명서, and what it says (ADR-0176 decision 5) - pure, so it is tested\n * without a server.\n */\n\n/** Where the caller stands to an employee: the record is theirs, and what they hold. */\nexport interface CertificateStanding {\n own: boolean\n /** `employee-self:mutation` - every employee's, for their own records. */\n self: boolean\n /** `employee-certificate:mutation` - `organization.certificates-issuing`. */\n issuing: boolean\n /** `employee-certificate:query`. */\n reading: boolean\n}\n\n/** One's own 재직증명서 is one's own to issue; anyone else's, and every 경력증명서, is the issuing task's (Q3 · Q4). */\nexport function mayIssueCertificate(kind: string, standing: CertificateStanding): boolean {\n if (standing.issuing) return true\n return kind === 'organization.employment-certificate' && standing.own && standing.self\n}\n\n/** The person it is about reads it; so does whoever reads the certificates. */\nexport function mayReadCertificate(standing: CertificateStanding): boolean {\n return standing.reading || standing.issuing || standing.own\n}\n\n/** What a certificate prints of the employee - no birth date or address (Q2). */\nexport interface CertificateFacts {\n name: string\n department: string\n jobPosition: string\n jobResponsibility: string\n hiredOn: string\n /** The last day - the day of issue (현재) for a 재직증명서, the retirement day for one who left. */\n until: string\n current: boolean\n}\n\nconst day = (value: unknown) => (typeof value === 'string' ? value.slice(0, 10) : value instanceof Date ? value.toISOString().slice(0, 10) : '')\n\n/**\n * The facts of an employee as of `today`. A 재직증명서 is for one still employed; a 경력증명서 is for anyone with a hire\n * day - one who left ends on the retirement day, one still employed on today. Refuses what the record cannot certify.\n */\nexport function certificateFacts(kind: string, employee: { name?: string | null; department?: { name?: string | null } | null; jobPosition?: string | null; jobResponsibility?: string | null; hiredOn?: any; retiredOn?: any }, today: string): CertificateFacts {\n const hiredOn = day(employee.hiredOn)\n const retiredOn = day(employee.retiredOn)\n if (!hiredOn) throw new Refusal('certificate-hired-on-missing', {}, 'record the hire day first')\n const current = !retiredOn || retiredOn >= today\n if (kind === 'organization.employment-certificate' && !current) throw new Refusal('certificate-not-employed', {}, 'a 재직증명서 is for one still employed - issue a 경력증명서')\n return {\n name: employee.name ?? '',\n department: employee.department?.name ?? '',\n jobPosition: employee.jobPosition ?? '',\n jobResponsibility: employee.jobResponsibility ?? '',\n hiredOn,\n until: current ? today : retiredOn,\n current\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"employment-certificate-templates.js","sourceRoot":"","sources":["../../../server/service/certificate/employment-certificate-templates.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,6CAA+D;AAE/D,MAAM,IAAI,GAAG,CAAC,KAAa,EAAE,IAAY,EAAE,SAAiB,EAAE,EAAE,CAAC;;;;;;;;;;;EAW/D,kBAAY;;;MAGR,KAAK;;EAET,IAAI;;;;uBAIiB,SAAS;;EAE9B,IAAA,iBAAW,GAAE;qBACM,CAAA;AAER,QAAA,mBAAmB,GAAG,IAAI,CACrC,OAAO,EACP;;2FAEyF,EACzF,8BAA8B,CAC/B,CAAA;AAEY,QAAA,eAAe,GAAG,IAAI,CACjC,OAAO,EACP;;;0HAGwH,EACxH,+BAA+B,CAChC,CAAA","sourcesContent":["/*\n * The templates in code of 재직증명서 · 경력증명서 (ADR-0176 decision 5) - a domain's own `PDFTemplate` of the kind prints\n * in their place. They read `employee` (the facts), `issue` (number, day, purpose, recipient) and `company` (「우리 회사」\n * with its seal as a data: URL).\n */\nimport { ISSUER_STYLE, issuerBlock } from '@things-factory/pdf'\n\nconst page = (title: string, rows: string, statement: string) => `<!doctype html><html lang=\"ko\"><head><meta charset=\"utf-8\"><style>\n@page { size: A4; margin: 0 }\nbody { margin: 0; font-family: \"Apple SD Gothic Neo\", \"Malgun Gothic\", \"Noto Sans KR\", sans-serif; color: #222 }\n.page { position: relative; box-sizing: border-box; width: 210mm; height: 297mm; padding: 30mm 24mm }\n.number { position: absolute; top: 16mm; left: 24mm; font-size: 9.5pt; color: #666 }\nh1 { margin: 6mm 0 16mm; text-align: center; font-size: 26pt; letter-spacing: 12pt }\ntable { width: 100%; border-collapse: collapse; font-size: 11.5pt }\nth, td { border: 1px solid #444; padding: 3.2mm 4mm; text-align: left; vertical-align: middle }\nth { width: 30mm; background: #f2f2f2; font-weight: 600; text-align: center }\n.statement { margin: 22mm 0 0; text-align: center; font-size: 13pt; line-height: 2 }\n.date { margin-top: 18mm; text-align: center; font-size: 13pt; letter-spacing: 1pt }\n${ISSUER_STYLE}\n</style></head><body><div class=\"page\">\n<div class=\"number\">발급번호 {{issue.number}}</div>\n<h1>${title}</h1>\n<table>\n${rows}\n<tr><th>용도</th><td colspan=\"3\">{{issue.purpose}}</td></tr>\n<tr><th>제출처</th><td colspan=\"3\">{{issue.submittedTo}}</td></tr>\n</table>\n<p class=\"statement\">${statement}</p>\n<div class=\"date\">{{issue.issuedOn}}</div>\n${issuerBlock()}\n</div></body></html>`\n\nexport const EMPLOYMENT_TEMPLATE = page(\n '재직증명서',\n `<tr><th>성명</th><td colspan=\"3\">{{employee.name}}</td></tr>\n<tr><th>소속</th><td>{{employee.department}}</td><th>직위</th><td>{{employee.jobPosition}}</td></tr>\n<tr><th>재직 기간</th><td colspan=\"3\">{{employee.hiredOn}} ~ {{employee.until}} (현재)</td></tr>`,\n '위 사람은 현재 당사에 재직하고 있음을 증명합니다.'\n)\n\nexport const CAREER_TEMPLATE = page(\n '경력증명서',\n `<tr><th>성명</th><td colspan=\"3\">{{employee.name}}</td></tr>\n<tr><th>소속</th><td>{{employee.department}}</td><th>직위</th><td>{{employee.jobPosition}}</td></tr>\n<tr><th>담당 업무</th><td colspan=\"3\">{{employee.jobResponsibility}}</td></tr>\n<tr><th>근무 기간</th><td colspan=\"3\">{{employee.hiredOn}} ~ {{employee.until}}{{#if employee.current}} (현재){{/if}}</td></tr>`,\n '위 사람은 위와 같이 당사에 근무하였음을 증명합니다.'\n)\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"employment-certificates.js","sourceRoot":"","sources":["../../../server/service/certificate/employment-certificates.ts"],"names":[],"mappings":";;;AAAA,yDAA2E;AAC3E,6CAAgE;AAChE,iDAA2E;AAE3E,mDAA+C;AAC/C,yDAAuD;AACvD,iFAA0G;AAC1G,yFAAyF;AAEzF;;;;GAIG;AACU,QAAA,2BAA2B,GAAG,qCAAqC,CAAA;AACnE,QAAA,uBAAuB,GAAG,iCAAiC,CAAA;AAExE,gGAAgG;AAChG,IAAA,6BAAiB,EAAC,sCAAsC,EAAE;IACxD,CAAC,sBAAsB,EAAE,OAAO,CAAC;IACjC,CAAC,sBAAsB,EAAE,UAAU,CAAC;CACrC,CAAC,CAAA;AAEF,4DAA4D;AAC5D,KAAK,UAAU,UAAU,CAAC,OAAY,EAAE,UAAqC;IAC3E,OAAO;QACL,GAAG,EAAE,CAAC,CAAC,UAAU,IAAI,CAAC,MAAM,IAAA,2BAAa,EAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC;QACxE,IAAI,EAAE,MAAM,IAA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,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;YACjD,MAAM,KAAK,GAAG,IAAA,+CAAgB,EAAC,IAAI,EAAE,QAAQ,EAAE,IAAA,mBAAW,EAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAA;YAC1F,OAAO,EAAE,WAAW,EAAE,QAAQ,CAAC,IAAI,IAAI,EAAE,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,CAAA;QACxE,CAAC;QACD,iFAAiF;QACjF,KAAK,CAAC,UAAU,CAAC,OAAO;YACtB,MAAM,IAAI,GAAG,MAAM,IAAA,2BAAa,EAAC,OAAO,CAAC,CAAA;YACzC,OAAO,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;QAC3C,CAAC;QACD,KAAK,CAAC,QAAQ,CAAC,OAAO,EAAE,KAAK;YAC3B,OAAO,IAAA,kDAAmB,EAAC,IAAI,EAAE,MAAM,UAAU,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAA;QACpE,CAAC;QACD,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG;YACxB,OAAO,IAAA,iDAAkB,EAAC,MAAM,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,CAAA;QACjE,CAAC;KACF,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import { declarePrivileges, requestHolds } from '@things-factory/auth-base'\nimport { registerIssuedDocumentKind } from '@things-factory/pdf'\nimport { calendarDay, getRepository, Refusal } from '@things-factory/shell'\n\nimport { Employee } from '../employee/employee'\nimport { myEmployeeIds } from '../employee/my-employee'\nimport { certificateFacts, mayIssueCertificate, mayReadCertificate } from './employment-certificate-rules'\nimport { CAREER_TEMPLATE, EMPLOYMENT_TEMPLATE } from './employment-certificate-templates'\n\n/*\n * 재직증명서 · 경력증명서 - issued documents of the employment, which organization owns (ADR-0176 decision 5). An employee\n * issues their own 재직증명서 (`employee-self`); everyone else's, and every 경력증명서, under `employee-certificate`\n * (`organization.certificates-issuing`). No birth date or address is printed (Q2).\n */\nexport const EMPLOYMENT_CERTIFICATE_KIND = 'organization.employment-certificate'\nexport const CAREER_CERTIFICATE_KIND = 'organization.career-certificate'\n\n/* Asked here only - no field gates on it - so declared here, or no role could be granted it. */\ndeclarePrivileges('organization employment certificates', [\n ['employee-certificate', 'query'],\n ['employee-certificate', 'mutation']\n])\n\n/** Who is asking about whom: theirs, and what they hold. */\nasync function standingOf(context: any, employeeId: string | null | undefined) {\n return {\n own: !!employeeId && (await myEmployeeIds(context)).includes(employeeId),\n self: await requestHolds(context, 'employee-self', 'mutation'),\n issuing: await requestHolds(context, 'employee-certificate', 'mutation'),\n reading: await requestHolds(context, 'employee-certificate', 'query')\n }\n}\n\nasync function employeeOf(context: any, id: string): Promise<Employee> {\n const { domain, tx } = context.state\n const employee = await getRepository(Employee, tx).findOne({ where: { id, domain: { id: domain.id } }, relations: ['department'] })\n if (!employee) throw new Refusal('employee-not-found', {}, 'the employee was not found')\n return employee\n}\n\nfor (const kind of [EMPLOYMENT_CERTIFICATE_KIND, CAREER_CERTIFICATE_KIND] as const) {\n const career = kind === CAREER_CERTIFICATE_KIND\n registerIssuedDocumentKind({\n kind,\n prefix: career ? '경력' : '재직',\n refType: 'Employee',\n template: { content_template: career ? CAREER_TEMPLATE : EMPLOYMENT_TEMPLATE, page_size: 'A4' },\n async dataOf(context, refId, input) {\n const employee = await employeeOf(context, refId)\n const facts = certificateFacts(kind, employee, calendarDay(context.state.domain.timezone))\n return { subjectName: employee.name ?? '', data: { employee: facts } }\n },\n /* One's own employee record - issued from 내 정보 › 내 증명서 (the issuance ledger). */\n async ownSubject(context) {\n const mine = await myEmployeeIds(context)\n return mine.length === 1 ? mine[0] : null\n },\n async mayIssue(context, refId) {\n return mayIssueCertificate(kind, await standingOf(context, refId))\n },\n async mayRead(context, row) {\n return mayReadCertificate(await standingOf(context, row.refId))\n }\n })\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"department-history.js","sourceRoot":"","sources":["../../../server/service/department/department-history.ts"],"names":[],"mappings":";;;;AAAA,+CAAoD;AACpD,qCAAyG;AAEzG,8DAKiC;AACjC,yDAAsD;AACtD,6CAA4C;AAC5C,iDAA8C;AAE9C,6CAAyC;AACzC,mDAA+C;AAE/C,MAAM,SAAS,GAAG,YAAM,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;AAC7C,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,CAAA;AAoB7B,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAAvB;QAOL,YAAO,GAAY,CAAC,CAAA;IAgGtB,CAAC;CAAA,CAAA;AAvGY,8CAAiB;AAGnB;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;6CACC;AAInB;IAFC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;IACtC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kDACN;AAIpB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IACzB,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;sCACb,cAAM;iDAAA;AAGf;IADC,IAAA,oBAAU,EAAC,CAAC,UAAsB,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC;;mDACzC;AAIjB;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,oBAAK,GAAE;;oDACS;AAIjB;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACb;AAIb;IAFC,IAA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index, ManyToOne, OneToMany, PrimaryGeneratedColumn, RelationId } from 'typeorm'\n\nimport {\n HistoryActionColumn,\n HistoryActionType,\n HistoryEntityInterface,\n HistoryOriginalIdColumn\n} from '@operato/typeorm-history'\nimport { Role, User } from '@things-factory/auth-base'\nimport { config } from '@things-factory/env'\nimport { Domain } from '@things-factory/shell'\n\nimport { Department } from './department'\nimport { Employee } from '../employee/employee'\n\nconst ORMCONFIG = config.get('ormconfig', {})\nconst DATABASE_TYPE = ORMCONFIG.type\n\n@Entity()\n@Index(\n 'ix_department_history_0',\n (departmentHistory: DepartmentHistory) => [departmentHistory.originalId, departmentHistory.version],\n { unique: true }\n)\n@Index(\n 'ix_department_history_1',\n (departmentHistory: DepartmentHistory) => [\n departmentHistory.domain,\n departmentHistory.originalId,\n departmentHistory.version\n ],\n {\n unique: true\n }\n)\n@ObjectType({ description: 'History Entity of Department' })\nexport class DepartmentHistory implements HistoryEntityInterface<Department> {\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((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 @ManyToOne(type => Employee, manager => manager.manages, { nullable: true })\n @Field({ 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 @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((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 @Field(type => String, { nullable: true })\n picture?: 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":"department-mutation.js","sourceRoot":"","sources":["../../../server/service/department/department-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAqF;AACrF,qCAA4B;AAE5B,iDAAoE;AACpE,qEAA0F;AAE1F,6CAAyC;AACzC,uDAAkE;AAClE,mDAA+C;AAC/C,2DAAmD;AACnD,0DAAuD;AAIhD,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAIvB,AAAN,KAAK,CAAC,gBAAgB,CACD,UAAyB,EACrC,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,OAAO,GAAG,MAAM,IAA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AE,CAAA;;;;2DAYP;6BArPU,kBAAkB;IAF9B,IAAA,uBAAQ,EAAC,uBAAU,CAAC;IACpB,IAAA,4BAAa,EAAC,qBAAa,CAAC;GAChB,kBAAkB,CAsP9B","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive, UseMiddleware } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { getRepository, SpeakRefusals } from '@things-factory/shell'\nimport { createAttachment, deleteAttachmentsByRef } from '@things-factory/attachment-base'\n\nimport { Department } from './department'\nimport { NewDepartment, DepartmentPatch } from './department-type'\nimport { Employee } from '../employee/employee'\nimport { checkedParent } from './department-parent'\nimport { referenceInDomain } from '../domain-reference'\n\n@Resolver(Department)\n@UseMiddleware(SpeakRefusals)\nexport class DepartmentMutation {\n @Directive('@transaction')\n @Directive('@privilege(category: \"department\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Department, { description: 'To create new Department' })\n async createDepartment(\n @Arg('department') department: NewDepartment,\n @Ctx() context: ResolverContext\n ): Promise<Department> {\n const { domain, user, tx } = context.state\n\n const manager = await referenceInDomain(\n getRepository(Employee, tx),\n 'manager' in department ? department.manager : undefined,\n domain,\n 'manager'\n )\n\n const parent = await checkedParent(undefined, department, getRepository(Department, tx), domain)\n\n const result = await getRepository(Department, tx).save({\n ...department,\n parent,\n domain,\n manager,\n creator: user,\n updater: user\n })\n\n if (department.picture) {\n await createAttachment(\n null,\n {\n attachment: {\n file: department.picture,\n refType: Department.name,\n refBy: result.id\n }\n },\n context\n )\n }\n\n return result\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"department\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Department, { description: 'To modify Department information' })\n async updateDepartment(\n @Arg('id') id: string,\n @Arg('patch') patch: DepartmentPatch,\n @Ctx() context: ResolverContext\n ): Promise<Department> {\n const { domain, user, tx } = context.state\n\n const repository = getRepository(Department, tx)\n const department = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const manager = await referenceInDomain(\n getRepository(Employee, tx),\n 'manager' in patch ? patch.manager : undefined,\n domain,\n 'manager'\n )\n\n const parent = await checkedParent(id, patch, repository, domain)\n\n const result = await repository.save({\n ...department,\n ...patch,\n ...(parent !== undefined && { parent }),\n manager,\n updater: user\n })\n\n if (patch.picture) {\n await deleteAttachmentsByRef(null, { refBys: [result.id] }, context)\n await createAttachment(\n null,\n {\n attachment: {\n file: patch.picture,\n refType: Department.name,\n refBy: result.id\n }\n },\n context\n )\n }\n\n return result\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"department\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => [Department], { description: \"To modify multiple Departments' information\" })\n async updateMultipleDepartment(\n @Arg('patches', type => [DepartmentPatch]) patches: DepartmentPatch[],\n @Ctx() context: ResolverContext\n ): Promise<Department[]> {\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 departmentRepo = getRepository(Department, tx)\n\n if (_createRecords.length > 0) {\n for (let i = 0; i < _createRecords.length; i++) {\n const newRecord = _createRecords[i]\n const manager = await referenceInDomain(\n getRepository(Employee, tx),\n 'manager' in newRecord ? newRecord.manager : undefined,\n domain,\n 'manager'\n )\n\n const parent = await checkedParent(undefined, newRecord, departmentRepo, domain)\n\n const result = await departmentRepo.save({\n ...newRecord,\n parent,\n manager,\n domain,\n creator: user,\n updater: user\n })\n\n if (newRecord.picture) {\n await createAttachment(\n null,\n {\n attachment: {\n file: newRecord.picture,\n refType: Department.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 const department = await departmentRepo.findOne({\n where: { domain: { id: domain.id }, id: updateRecord.id }\n })\n\n if (!department) {\n throw new Error(`failed to find department to update: ${updateRecord.id}`)\n }\n const manager = await referenceInDomain(\n getRepository(Employee, tx),\n 'manager' in updateRecord ? updateRecord.manager : undefined,\n domain,\n 'manager'\n )\n\n const parent = await checkedParent(department.id, updateRecord, departmentRepo, domain)\n\n const result = await departmentRepo.save({\n ...department,\n ...updateRecord,\n ...(parent !== undefined && { parent }),\n manager,\n updater: user\n })\n\n if (updateRecord.picture) {\n await deleteAttachmentsByRef(null, { refBys: [result.id] }, context)\n await createAttachment(\n null,\n {\n attachment: {\n file: updateRecord.picture,\n refType: Department.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: \"department\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, { description: 'To delete Department' })\n async deleteDepartment(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(Department, tx).softDelete({ 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: \"department\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, { description: 'To delete multiple Departments' })\n async deleteDepartments(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(Department, tx).softDelete({\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: \"department\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, { description: 'To import multiple Departments' })\n async importDepartments(\n @Arg('departments', type => [DepartmentPatch]) departments: DepartmentPatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n const repository = getRepository(Department, tx)\n\n for (const department of departments) {\n const parent = await checkedParent(undefined, department, repository, domain)\n await repository.save({ domain, ...department, parent })\n }\n\n return true\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"department-parent.js","sourceRoot":"","sources":["../../../server/service/department/department-parent.ts"],"names":[],"mappings":";;AAiBA,sCA2BC;AA1CD,iDAAuD;AAIvD;;;;;;;;;;GAUG;AACI,KAAK,UAAU,aAAa,CACjC,YAAgC,EAChC,KAA0C,EAC1C,UAAkC,EAClC,MAAc;IAEd,IAAI,CAAC,CAAC,QAAQ,IAAI,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS;QAAE,OAAO,SAAS,CAAA;IACxE,IAAI,KAAK,CAAC,MAAM,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;QAAE,OAAO,IAAI,CAAA;IAE1D,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,EAAE,CAAA;IAChC,IAAI,QAAQ,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAA;IAE/F,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,eAAO,CAAC,6BAA6B,EAAE,EAAE,EAAE,gCAAgC,QAAQ,EAAE,CAAC,CAAA;IAClG,CAAC;IAED,OAAO,QAAQ,EAAE,CAAC;QAChB,IAAI,YAAY,IAAI,QAAQ,CAAC,EAAE,KAAK,YAAY,EAAE,CAAC;YACjD,MAAM,IAAI,eAAO,CAAC,wBAAwB,EAAE,EAAE,EAAE,uFAAuF,QAAQ,EAAE,CAAC,CAAA;QACpJ,CAAC;QAED,QAAQ,GAAG,QAAQ,CAAC,QAAQ;YAC1B,CAAC,CAAC,MAAM,UAAU,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,QAAQ,CAAC,QAAQ,EAAE,EAAE,CAAC;YAC3F,CAAC,CAAC,IAAI,CAAA;IACV,CAAC;IAED,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAA;AACzB,CAAC","sourcesContent":["import { Repository } from 'typeorm'\n\nimport { Domain, Refusal } from '@things-factory/shell'\n\nimport { Department } from './department'\n\n/*\n * The parent a patch asks for, checked before it is saved.\n *\n * A department is refused as its own parent, and so is any department under it: the hierarchy would\n * loop, and every screen that walks it (the department list, the selector, the employee rail) would\n * lose that branch. The walk goes up from the requested parent, so it reads as many rows as the\n * organization is deep.\n *\n * 'parent' absent from the patch leaves the parent as it is (undefined); null makes the department\n * top-level.\n */\nexport async function checkedParent(\n departmentId: string | undefined,\n patch: { parent?: { id?: string } | null },\n repository: Repository<Department>,\n domain: Domain\n): Promise<{ id: string } | null | undefined> {\n if (!('parent' in patch) || patch.parent === undefined) return undefined\n if (patch.parent === null || !patch.parent.id) return null\n\n const parentId = patch.parent.id\n let ancestor = await repository.findOne({ where: { domain: { id: domain.id }, id: parentId } })\n\n if (!ancestor) {\n throw new Refusal('department-parent-not-found', {}, `parent department not found: ${parentId}`)\n }\n\n while (ancestor) {\n if (departmentId && ancestor.id === departmentId) {\n throw new Refusal('department-parent-loop', {}, `a department cannot be placed under itself or under one of its own sub-departments: ${parentId}`)\n }\n\n ancestor = ancestor.parentId\n ? await repository.findOne({ where: { domain: { id: domain.id }, id: ancestor.parentId } })\n : null\n }\n\n return { id: parentId }\n}\n"]}
|