@things-factory/work-shift 10.1.248 → 10.1.250
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-client/bootstrap.d.ts +1 -0
- package/dist-client/bootstrap.js +6 -0
- package/dist-client/bootstrap.js.map +1 -0
- package/dist-client/index.d.ts +0 -0
- package/dist-client/index.js +2 -0
- package/dist-client/index.js.map +1 -0
- package/dist-client/pages/work-shift.d.ts +105 -0
- package/dist-client/pages/work-shift.js +1144 -0
- package/dist-client/pages/work-shift.js.map +1 -0
- package/dist-client/route.d.ts +1 -0
- package/dist-client/route.js +8 -0
- package/dist-client/route.js.map +1 -0
- package/dist-client/shift-coverage.d.ts +102 -0
- package/dist-client/shift-coverage.js +196 -0
- package/dist-client/shift-coverage.js.map +1 -0
- package/dist-client/shift-editing.d.ts +80 -0
- package/dist-client/shift-editing.js +212 -0
- package/dist-client/shift-editing.js.map +1 -0
- package/dist-client/shift-revisions.d.ts +73 -0
- package/dist-client/shift-revisions.js +64 -0
- package/dist-client/shift-revisions.js.map +1 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -0
- package/dist-server/controllers/index.d.ts +2 -0
- package/dist-server/controllers/index.js +6 -0
- package/dist-server/controllers/index.js.map +1 -0
- package/dist-server/controllers/work-shift-range.d.ts +28 -0
- package/dist-server/controllers/work-shift-range.js +65 -0
- package/dist-server/controllers/work-shift-range.js.map +1 -0
- package/dist-server/controllers/work-shift-schedule.d.ts +5 -0
- package/dist-server/controllers/work-shift-schedule.js +60 -0
- package/dist-server/controllers/work-shift-schedule.js.map +1 -0
- package/dist-server/index.d.ts +2 -0
- package/dist-server/index.js +19 -0
- package/dist-server/index.js.map +1 -0
- package/dist-server/service/index.d.ts +13 -0
- package/dist-server/service/index.js +33 -0
- package/dist-server/service/index.js.map +1 -0
- package/dist-server/service/work-shift/days-of-week.d.ts +30 -0
- package/dist-server/service/work-shift/days-of-week.js +74 -0
- package/dist-server/service/work-shift/days-of-week.js.map +1 -0
- package/dist-server/service/work-shift/index.d.ts +9 -0
- package/dist-server/service/work-shift/index.js +20 -0
- package/dist-server/service/work-shift/index.js.map +1 -0
- package/dist-server/service/work-shift/shift-occurrence.d.ts +19 -0
- package/dist-server/service/work-shift/shift-occurrence.js +34 -0
- package/dist-server/service/work-shift/shift-occurrence.js.map +1 -0
- package/dist-server/service/work-shift/work-shift-arrangement.d.ts +10 -0
- package/dist-server/service/work-shift/work-shift-arrangement.js +40 -0
- package/dist-server/service/work-shift/work-shift-arrangement.js.map +1 -0
- package/dist-server/service/work-shift/work-shift-baseline.d.ts +23 -0
- package/dist-server/service/work-shift/work-shift-baseline.js +55 -0
- package/dist-server/service/work-shift/work-shift-baseline.js.map +1 -0
- package/dist-server/service/work-shift/work-shift-change-approval.d.ts +14 -0
- package/dist-server/service/work-shift/work-shift-change-approval.js +64 -0
- package/dist-server/service/work-shift/work-shift-change-approval.js.map +1 -0
- package/dist-server/service/work-shift/work-shift-content.d.ts +18 -0
- package/dist-server/service/work-shift/work-shift-content.js +62 -0
- package/dist-server/service/work-shift/work-shift-content.js.map +1 -0
- package/dist-server/service/work-shift/work-shift-lifecycle-resolver.d.ts +68 -0
- package/dist-server/service/work-shift/work-shift-lifecycle-resolver.js +89 -0
- package/dist-server/service/work-shift/work-shift-lifecycle-resolver.js.map +1 -0
- package/dist-server/service/work-shift/work-shift-lifecycle.d.ts +229 -0
- package/dist-server/service/work-shift/work-shift-lifecycle.js +672 -0
- package/dist-server/service/work-shift/work-shift-lifecycle.js.map +1 -0
- package/dist-server/service/work-shift/work-shift-mutation.d.ts +16 -0
- package/dist-server/service/work-shift/work-shift-mutation.js +77 -0
- package/dist-server/service/work-shift/work-shift-mutation.js.map +1 -0
- package/dist-server/service/work-shift/work-shift-query.d.ts +14 -0
- package/dist-server/service/work-shift/work-shift-query.js +116 -0
- package/dist-server/service/work-shift/work-shift-query.js.map +1 -0
- package/dist-server/service/work-shift/work-shift-revision-service.d.ts +32 -0
- package/dist-server/service/work-shift/work-shift-revision-service.js +89 -0
- package/dist-server/service/work-shift/work-shift-revision-service.js.map +1 -0
- package/dist-server/service/work-shift/work-shift-revision.d.ts +85 -0
- package/dist-server/service/work-shift/work-shift-revision.js +337 -0
- package/dist-server/service/work-shift/work-shift-revision.js.map +1 -0
- package/dist-server/service/work-shift/work-shift-selection.d.ts +50 -0
- package/dist-server/service/work-shift/work-shift-selection.js +65 -0
- package/dist-server/service/work-shift/work-shift-selection.js.map +1 -0
- package/dist-server/service/work-shift/work-shift-type.d.ts +26 -0
- package/dist-server/service/work-shift/work-shift-type.js +77 -0
- package/dist-server/service/work-shift/work-shift-type.js.map +1 -0
- package/dist-server/service/work-shift/work-shift.d.ts +56 -0
- package/dist-server/service/work-shift/work-shift.js +109 -0
- package/dist-server/service/work-shift/work-shift.js.map +1 -0
- package/dist-server/tsconfig.tsbuildinfo +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { Domain } from '@things-factory/shell';
|
|
2
|
+
import { User } from '@things-factory/auth-base';
|
|
3
|
+
import { WorkShiftArrangement } from './work-shift-arrangement';
|
|
4
|
+
import { MasterChangePolicy } from '@things-factory/ops-master';
|
|
5
|
+
/** Content and the proposed effective date freeze together. Worklist owns the decision. */
|
|
6
|
+
export declare class WorkShiftRevision {
|
|
7
|
+
/** Human revision number within one identity; assigned once under the subject write lock. */
|
|
8
|
+
revisionNumber: number;
|
|
9
|
+
policy: MasterChangePolicy;
|
|
10
|
+
policyId: string;
|
|
11
|
+
id: string;
|
|
12
|
+
domain: Domain;
|
|
13
|
+
domainId: string;
|
|
14
|
+
arrangement: WorkShiftArrangement;
|
|
15
|
+
arrangementId: string;
|
|
16
|
+
baseRevision: WorkShiftRevision | null;
|
|
17
|
+
baseRevisionId: string | null;
|
|
18
|
+
baseGeneration: number;
|
|
19
|
+
editGeneration: number;
|
|
20
|
+
description: string | null;
|
|
21
|
+
timezone: string;
|
|
22
|
+
shifts: import('./work-shift-content').ShiftDefinition[];
|
|
23
|
+
effectiveFrom: Date;
|
|
24
|
+
reason: string;
|
|
25
|
+
/** Empty only on a baseline: nobody wrote it, it records the shifts as they already stood. */
|
|
26
|
+
creator: User | null;
|
|
27
|
+
creatorId: string | null;
|
|
28
|
+
createdAt: Date;
|
|
29
|
+
frozenAt: Date | null;
|
|
30
|
+
contentHash: string | null;
|
|
31
|
+
/** Opaque product decision ID: the common master module does not depend on worklist. */
|
|
32
|
+
activityInstanceId: string | null;
|
|
33
|
+
}
|
|
34
|
+
/** An append-only generation of the complete schedule for one arrangement. */
|
|
35
|
+
export declare class WorkShiftPlan {
|
|
36
|
+
policy: MasterChangePolicy;
|
|
37
|
+
policyId: string;
|
|
38
|
+
publishedRevision: WorkShiftRevision;
|
|
39
|
+
publishedRevisionId: string;
|
|
40
|
+
/** `baseline`: stood at boot from shifts that predate revisions. No approver, no publisher. */
|
|
41
|
+
releaseKind: 'approved' | 'policy' | 'baseline';
|
|
42
|
+
publisher: User | null;
|
|
43
|
+
publisherId: string | null;
|
|
44
|
+
id: string;
|
|
45
|
+
domain: Domain;
|
|
46
|
+
domainId: string;
|
|
47
|
+
arrangement: WorkShiftArrangement;
|
|
48
|
+
arrangementId: string;
|
|
49
|
+
generation: number;
|
|
50
|
+
recordedAt: Date;
|
|
51
|
+
activityInstanceId: string | null;
|
|
52
|
+
approver: User;
|
|
53
|
+
approverId: string;
|
|
54
|
+
submissionHash: string;
|
|
55
|
+
}
|
|
56
|
+
export declare class WorkShiftSegment {
|
|
57
|
+
id: string;
|
|
58
|
+
domain: Domain;
|
|
59
|
+
domainId: string;
|
|
60
|
+
arrangement: WorkShiftArrangement;
|
|
61
|
+
arrangementId: string;
|
|
62
|
+
plan: WorkShiftPlan;
|
|
63
|
+
planId: string;
|
|
64
|
+
revision: WorkShiftRevision;
|
|
65
|
+
revisionId: string;
|
|
66
|
+
validFrom: Date;
|
|
67
|
+
validTo: Date | null;
|
|
68
|
+
}
|
|
69
|
+
/** Permanent evidence of the selected revision, also the retroactivity interlock. */
|
|
70
|
+
export declare class WorkShiftBasis {
|
|
71
|
+
id: string;
|
|
72
|
+
domain: Domain;
|
|
73
|
+
domainId: string;
|
|
74
|
+
arrangement: WorkShiftArrangement;
|
|
75
|
+
arrangementId: string;
|
|
76
|
+
recordKey: string;
|
|
77
|
+
revision: WorkShiftRevision;
|
|
78
|
+
revisionId: string;
|
|
79
|
+
plan: WorkShiftPlan;
|
|
80
|
+
planId: string;
|
|
81
|
+
contentHash: string;
|
|
82
|
+
businessTime: Date;
|
|
83
|
+
resolvedAt: Date;
|
|
84
|
+
}
|
|
85
|
+
export declare const WORK_SHIFT_REVISION_ENTITIES: (typeof WorkShiftRevision | typeof WorkShiftPlan | typeof WorkShiftSegment | typeof WorkShiftBasis)[];
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WORK_SHIFT_REVISION_ENTITIES = exports.WorkShiftBasis = exports.WorkShiftSegment = exports.WorkShiftPlan = exports.WorkShiftRevision = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const typeorm_1 = require("typeorm");
|
|
6
|
+
const shell_1 = require("@things-factory/shell");
|
|
7
|
+
const auth_base_1 = require("@things-factory/auth-base");
|
|
8
|
+
const work_shift_arrangement_1 = require("./work-shift-arrangement");
|
|
9
|
+
const ops_master_1 = require("@things-factory/ops-master");
|
|
10
|
+
// Relations own the columns and RelationId exposes read-only identifiers.
|
|
11
|
+
// Where a composite FK is declared, disable only the redundant single-column FK;
|
|
12
|
+
// the database still enforces existence, domain and arrangement together.
|
|
13
|
+
/** Content and the proposed effective date freeze together. Worklist owns the decision. */
|
|
14
|
+
let WorkShiftRevision = class WorkShiftRevision {
|
|
15
|
+
};
|
|
16
|
+
exports.WorkShiftRevision = WorkShiftRevision;
|
|
17
|
+
tslib_1.__decorate([
|
|
18
|
+
(0, typeorm_1.Column)('int'),
|
|
19
|
+
tslib_1.__metadata("design:type", Number)
|
|
20
|
+
], WorkShiftRevision.prototype, "revisionNumber", void 0);
|
|
21
|
+
tslib_1.__decorate([
|
|
22
|
+
(0, typeorm_1.ManyToOne)(() => ops_master_1.MasterChangePolicy, { nullable: false, createForeignKeyConstraints: false }),
|
|
23
|
+
tslib_1.__metadata("design:type", ops_master_1.MasterChangePolicy)
|
|
24
|
+
], WorkShiftRevision.prototype, "policy", void 0);
|
|
25
|
+
tslib_1.__decorate([
|
|
26
|
+
(0, typeorm_1.RelationId)((row) => row.policy),
|
|
27
|
+
tslib_1.__metadata("design:type", String)
|
|
28
|
+
], WorkShiftRevision.prototype, "policyId", void 0);
|
|
29
|
+
tslib_1.__decorate([
|
|
30
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
31
|
+
tslib_1.__metadata("design:type", String)
|
|
32
|
+
], WorkShiftRevision.prototype, "id", void 0);
|
|
33
|
+
tslib_1.__decorate([
|
|
34
|
+
(0, typeorm_1.ManyToOne)(() => shell_1.Domain, { nullable: false }),
|
|
35
|
+
tslib_1.__metadata("design:type", shell_1.Domain)
|
|
36
|
+
], WorkShiftRevision.prototype, "domain", void 0);
|
|
37
|
+
tslib_1.__decorate([
|
|
38
|
+
(0, typeorm_1.RelationId)((row) => row.domain),
|
|
39
|
+
tslib_1.__metadata("design:type", String)
|
|
40
|
+
], WorkShiftRevision.prototype, "domainId", void 0);
|
|
41
|
+
tslib_1.__decorate([
|
|
42
|
+
(0, typeorm_1.ManyToOne)('WorkShiftArrangement', { nullable: false, createForeignKeyConstraints: false }),
|
|
43
|
+
tslib_1.__metadata("design:type", work_shift_arrangement_1.WorkShiftArrangement)
|
|
44
|
+
], WorkShiftRevision.prototype, "arrangement", void 0);
|
|
45
|
+
tslib_1.__decorate([
|
|
46
|
+
(0, typeorm_1.RelationId)((row) => row.arrangement),
|
|
47
|
+
tslib_1.__metadata("design:type", String)
|
|
48
|
+
], WorkShiftRevision.prototype, "arrangementId", void 0);
|
|
49
|
+
tslib_1.__decorate([
|
|
50
|
+
(0, typeorm_1.ManyToOne)(() => WorkShiftRevision, { nullable: true, createForeignKeyConstraints: false }),
|
|
51
|
+
tslib_1.__metadata("design:type", WorkShiftRevision)
|
|
52
|
+
], WorkShiftRevision.prototype, "baseRevision", void 0);
|
|
53
|
+
tslib_1.__decorate([
|
|
54
|
+
(0, typeorm_1.RelationId)((row) => row.baseRevision),
|
|
55
|
+
tslib_1.__metadata("design:type", String)
|
|
56
|
+
], WorkShiftRevision.prototype, "baseRevisionId", void 0);
|
|
57
|
+
tslib_1.__decorate([
|
|
58
|
+
(0, typeorm_1.Column)('int'),
|
|
59
|
+
tslib_1.__metadata("design:type", Number)
|
|
60
|
+
], WorkShiftRevision.prototype, "baseGeneration", void 0);
|
|
61
|
+
tslib_1.__decorate([
|
|
62
|
+
(0, typeorm_1.Column)('int', { default: 0 }),
|
|
63
|
+
tslib_1.__metadata("design:type", Number)
|
|
64
|
+
], WorkShiftRevision.prototype, "editGeneration", void 0);
|
|
65
|
+
tslib_1.__decorate([
|
|
66
|
+
(0, typeorm_1.Column)('text', { nullable: true }),
|
|
67
|
+
tslib_1.__metadata("design:type", String)
|
|
68
|
+
], WorkShiftRevision.prototype, "description", void 0);
|
|
69
|
+
tslib_1.__decorate([
|
|
70
|
+
(0, typeorm_1.Column)(),
|
|
71
|
+
tslib_1.__metadata("design:type", String)
|
|
72
|
+
], WorkShiftRevision.prototype, "timezone", void 0);
|
|
73
|
+
tslib_1.__decorate([
|
|
74
|
+
(0, typeorm_1.Column)('simple-json'),
|
|
75
|
+
tslib_1.__metadata("design:type", Array)
|
|
76
|
+
], WorkShiftRevision.prototype, "shifts", void 0);
|
|
77
|
+
tslib_1.__decorate([
|
|
78
|
+
(0, typeorm_1.Column)({ type: Date }),
|
|
79
|
+
tslib_1.__metadata("design:type", Date)
|
|
80
|
+
], WorkShiftRevision.prototype, "effectiveFrom", void 0);
|
|
81
|
+
tslib_1.__decorate([
|
|
82
|
+
(0, typeorm_1.Column)('text'),
|
|
83
|
+
tslib_1.__metadata("design:type", String)
|
|
84
|
+
], WorkShiftRevision.prototype, "reason", void 0);
|
|
85
|
+
tslib_1.__decorate([
|
|
86
|
+
(0, typeorm_1.ManyToOne)(() => auth_base_1.User, { nullable: true }),
|
|
87
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
88
|
+
], WorkShiftRevision.prototype, "creator", void 0);
|
|
89
|
+
tslib_1.__decorate([
|
|
90
|
+
(0, typeorm_1.RelationId)((row) => row.creator),
|
|
91
|
+
tslib_1.__metadata("design:type", String)
|
|
92
|
+
], WorkShiftRevision.prototype, "creatorId", void 0);
|
|
93
|
+
tslib_1.__decorate([
|
|
94
|
+
(0, typeorm_1.Column)({ type: Date }),
|
|
95
|
+
tslib_1.__metadata("design:type", Date)
|
|
96
|
+
], WorkShiftRevision.prototype, "createdAt", void 0);
|
|
97
|
+
tslib_1.__decorate([
|
|
98
|
+
(0, typeorm_1.Column)({ type: Date, nullable: true }),
|
|
99
|
+
tslib_1.__metadata("design:type", Date)
|
|
100
|
+
], WorkShiftRevision.prototype, "frozenAt", void 0);
|
|
101
|
+
tslib_1.__decorate([
|
|
102
|
+
(0, typeorm_1.Column)('varchar', { nullable: true }),
|
|
103
|
+
tslib_1.__metadata("design:type", String)
|
|
104
|
+
], WorkShiftRevision.prototype, "contentHash", void 0);
|
|
105
|
+
tslib_1.__decorate([
|
|
106
|
+
(0, typeorm_1.Column)('varchar', { nullable: true }),
|
|
107
|
+
tslib_1.__metadata("design:type", String)
|
|
108
|
+
], WorkShiftRevision.prototype, "activityInstanceId", void 0);
|
|
109
|
+
exports.WorkShiftRevision = WorkShiftRevision = tslib_1.__decorate([
|
|
110
|
+
(0, typeorm_1.Entity)('work_shift_revisions'),
|
|
111
|
+
(0, typeorm_1.Index)('ix_arrangement_revision_subject', ['domain', 'arrangement', 'id'], { unique: true }),
|
|
112
|
+
(0, typeorm_1.Index)('ix_arrangement_revision_list', ['domain', 'arrangement', 'createdAt']),
|
|
113
|
+
(0, typeorm_1.ForeignKey)(() => ops_master_1.MasterChangePolicy, ['domain', 'policy'], ['domain', 'id'], { onDelete: 'RESTRICT' }),
|
|
114
|
+
(0, typeorm_1.ForeignKey)('WorkShiftArrangement', ['domain', 'arrangement'], ['domain', 'id'], { onDelete: 'RESTRICT' }),
|
|
115
|
+
(0, typeorm_1.ForeignKey)('WorkShiftRevision', ['domain', 'arrangement', 'baseRevision'], ['domain', 'arrangement', 'id'], {
|
|
116
|
+
onDelete: 'RESTRICT'
|
|
117
|
+
}),
|
|
118
|
+
(0, typeorm_1.Index)('ix_arrangement_revision_number', ['domain', 'arrangement', 'revisionNumber'], { unique: true })
|
|
119
|
+
], WorkShiftRevision);
|
|
120
|
+
/** An append-only generation of the complete schedule for one arrangement. */
|
|
121
|
+
let WorkShiftPlan = class WorkShiftPlan {
|
|
122
|
+
};
|
|
123
|
+
exports.WorkShiftPlan = WorkShiftPlan;
|
|
124
|
+
tslib_1.__decorate([
|
|
125
|
+
(0, typeorm_1.ManyToOne)(() => ops_master_1.MasterChangePolicy, { nullable: false, createForeignKeyConstraints: false }),
|
|
126
|
+
tslib_1.__metadata("design:type", ops_master_1.MasterChangePolicy)
|
|
127
|
+
], WorkShiftPlan.prototype, "policy", void 0);
|
|
128
|
+
tslib_1.__decorate([
|
|
129
|
+
(0, typeorm_1.RelationId)((row) => row.policy),
|
|
130
|
+
tslib_1.__metadata("design:type", String)
|
|
131
|
+
], WorkShiftPlan.prototype, "policyId", void 0);
|
|
132
|
+
tslib_1.__decorate([
|
|
133
|
+
(0, typeorm_1.ManyToOne)(() => WorkShiftRevision, { nullable: false, createForeignKeyConstraints: false }),
|
|
134
|
+
tslib_1.__metadata("design:type", WorkShiftRevision)
|
|
135
|
+
], WorkShiftPlan.prototype, "publishedRevision", void 0);
|
|
136
|
+
tslib_1.__decorate([
|
|
137
|
+
(0, typeorm_1.RelationId)((row) => row.publishedRevision),
|
|
138
|
+
tslib_1.__metadata("design:type", String)
|
|
139
|
+
], WorkShiftPlan.prototype, "publishedRevisionId", void 0);
|
|
140
|
+
tslib_1.__decorate([
|
|
141
|
+
(0, typeorm_1.Column)('varchar'),
|
|
142
|
+
tslib_1.__metadata("design:type", String)
|
|
143
|
+
], WorkShiftPlan.prototype, "releaseKind", void 0);
|
|
144
|
+
tslib_1.__decorate([
|
|
145
|
+
(0, typeorm_1.ManyToOne)(() => auth_base_1.User, { nullable: true }),
|
|
146
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
147
|
+
], WorkShiftPlan.prototype, "publisher", void 0);
|
|
148
|
+
tslib_1.__decorate([
|
|
149
|
+
(0, typeorm_1.RelationId)((row) => row.publisher),
|
|
150
|
+
tslib_1.__metadata("design:type", String)
|
|
151
|
+
], WorkShiftPlan.prototype, "publisherId", void 0);
|
|
152
|
+
tslib_1.__decorate([
|
|
153
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
154
|
+
tslib_1.__metadata("design:type", String)
|
|
155
|
+
], WorkShiftPlan.prototype, "id", void 0);
|
|
156
|
+
tslib_1.__decorate([
|
|
157
|
+
(0, typeorm_1.ManyToOne)(() => shell_1.Domain, { nullable: false }),
|
|
158
|
+
tslib_1.__metadata("design:type", shell_1.Domain)
|
|
159
|
+
], WorkShiftPlan.prototype, "domain", void 0);
|
|
160
|
+
tslib_1.__decorate([
|
|
161
|
+
(0, typeorm_1.RelationId)((row) => row.domain),
|
|
162
|
+
tslib_1.__metadata("design:type", String)
|
|
163
|
+
], WorkShiftPlan.prototype, "domainId", void 0);
|
|
164
|
+
tslib_1.__decorate([
|
|
165
|
+
(0, typeorm_1.ManyToOne)('WorkShiftArrangement', { nullable: false, createForeignKeyConstraints: false }),
|
|
166
|
+
tslib_1.__metadata("design:type", work_shift_arrangement_1.WorkShiftArrangement)
|
|
167
|
+
], WorkShiftPlan.prototype, "arrangement", void 0);
|
|
168
|
+
tslib_1.__decorate([
|
|
169
|
+
(0, typeorm_1.RelationId)((row) => row.arrangement),
|
|
170
|
+
tslib_1.__metadata("design:type", String)
|
|
171
|
+
], WorkShiftPlan.prototype, "arrangementId", void 0);
|
|
172
|
+
tslib_1.__decorate([
|
|
173
|
+
(0, typeorm_1.Column)('int'),
|
|
174
|
+
tslib_1.__metadata("design:type", Number)
|
|
175
|
+
], WorkShiftPlan.prototype, "generation", void 0);
|
|
176
|
+
tslib_1.__decorate([
|
|
177
|
+
(0, typeorm_1.Column)({ type: Date }),
|
|
178
|
+
tslib_1.__metadata("design:type", Date)
|
|
179
|
+
], WorkShiftPlan.prototype, "recordedAt", void 0);
|
|
180
|
+
tslib_1.__decorate([
|
|
181
|
+
(0, typeorm_1.Column)('varchar', { nullable: true }),
|
|
182
|
+
tslib_1.__metadata("design:type", String)
|
|
183
|
+
], WorkShiftPlan.prototype, "activityInstanceId", void 0);
|
|
184
|
+
tslib_1.__decorate([
|
|
185
|
+
(0, typeorm_1.ManyToOne)(() => auth_base_1.User, { nullable: true }),
|
|
186
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
187
|
+
], WorkShiftPlan.prototype, "approver", void 0);
|
|
188
|
+
tslib_1.__decorate([
|
|
189
|
+
(0, typeorm_1.RelationId)((row) => row.approver),
|
|
190
|
+
tslib_1.__metadata("design:type", String)
|
|
191
|
+
], WorkShiftPlan.prototype, "approverId", void 0);
|
|
192
|
+
tslib_1.__decorate([
|
|
193
|
+
(0, typeorm_1.Column)('varchar'),
|
|
194
|
+
tslib_1.__metadata("design:type", String)
|
|
195
|
+
], WorkShiftPlan.prototype, "submissionHash", void 0);
|
|
196
|
+
exports.WorkShiftPlan = WorkShiftPlan = tslib_1.__decorate([
|
|
197
|
+
(0, typeorm_1.Entity)('work_shift_plan'),
|
|
198
|
+
(0, typeorm_1.Index)('ix_arrangement_plan_generation', ['domain', 'arrangement', 'generation'], { unique: true }),
|
|
199
|
+
(0, typeorm_1.Index)('ix_arrangement_plan_identity', ['domain', 'arrangement', 'id'], { unique: true }),
|
|
200
|
+
(0, typeorm_1.Index)('ix_arrangement_plan_decision', ['activityInstanceId'], { unique: true }),
|
|
201
|
+
(0, typeorm_1.Index)('ix_arrangement_plan_publication', ['publishedRevision'], { unique: true }),
|
|
202
|
+
(0, typeorm_1.ForeignKey)(() => ops_master_1.MasterChangePolicy, ['domain', 'policy'], ['domain', 'id'], { onDelete: 'RESTRICT' }),
|
|
203
|
+
(0, typeorm_1.ForeignKey)(() => WorkShiftRevision, ['domain', 'arrangement', 'publishedRevision'], ['domain', 'arrangement', 'id'], { onDelete: 'RESTRICT' }),
|
|
204
|
+
(0, typeorm_1.ForeignKey)('WorkShiftArrangement', ['domain', 'arrangement'], ['domain', 'id'], { onDelete: 'RESTRICT' })
|
|
205
|
+
], WorkShiftPlan);
|
|
206
|
+
let WorkShiftSegment = class WorkShiftSegment {
|
|
207
|
+
};
|
|
208
|
+
exports.WorkShiftSegment = WorkShiftSegment;
|
|
209
|
+
tslib_1.__decorate([
|
|
210
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
211
|
+
tslib_1.__metadata("design:type", String)
|
|
212
|
+
], WorkShiftSegment.prototype, "id", void 0);
|
|
213
|
+
tslib_1.__decorate([
|
|
214
|
+
(0, typeorm_1.ManyToOne)(() => shell_1.Domain, { nullable: false }),
|
|
215
|
+
tslib_1.__metadata("design:type", shell_1.Domain)
|
|
216
|
+
], WorkShiftSegment.prototype, "domain", void 0);
|
|
217
|
+
tslib_1.__decorate([
|
|
218
|
+
(0, typeorm_1.RelationId)((row) => row.domain),
|
|
219
|
+
tslib_1.__metadata("design:type", String)
|
|
220
|
+
], WorkShiftSegment.prototype, "domainId", void 0);
|
|
221
|
+
tslib_1.__decorate([
|
|
222
|
+
(0, typeorm_1.ManyToOne)('WorkShiftArrangement', { nullable: false, createForeignKeyConstraints: false }),
|
|
223
|
+
tslib_1.__metadata("design:type", work_shift_arrangement_1.WorkShiftArrangement)
|
|
224
|
+
], WorkShiftSegment.prototype, "arrangement", void 0);
|
|
225
|
+
tslib_1.__decorate([
|
|
226
|
+
(0, typeorm_1.RelationId)((row) => row.arrangement),
|
|
227
|
+
tslib_1.__metadata("design:type", String)
|
|
228
|
+
], WorkShiftSegment.prototype, "arrangementId", void 0);
|
|
229
|
+
tslib_1.__decorate([
|
|
230
|
+
(0, typeorm_1.ManyToOne)(() => WorkShiftPlan, { nullable: false, createForeignKeyConstraints: false }),
|
|
231
|
+
tslib_1.__metadata("design:type", WorkShiftPlan)
|
|
232
|
+
], WorkShiftSegment.prototype, "plan", void 0);
|
|
233
|
+
tslib_1.__decorate([
|
|
234
|
+
(0, typeorm_1.RelationId)((row) => row.plan),
|
|
235
|
+
tslib_1.__metadata("design:type", String)
|
|
236
|
+
], WorkShiftSegment.prototype, "planId", void 0);
|
|
237
|
+
tslib_1.__decorate([
|
|
238
|
+
(0, typeorm_1.ManyToOne)(() => WorkShiftRevision, { nullable: false, createForeignKeyConstraints: false }),
|
|
239
|
+
tslib_1.__metadata("design:type", WorkShiftRevision)
|
|
240
|
+
], WorkShiftSegment.prototype, "revision", void 0);
|
|
241
|
+
tslib_1.__decorate([
|
|
242
|
+
(0, typeorm_1.RelationId)((row) => row.revision),
|
|
243
|
+
tslib_1.__metadata("design:type", String)
|
|
244
|
+
], WorkShiftSegment.prototype, "revisionId", void 0);
|
|
245
|
+
tslib_1.__decorate([
|
|
246
|
+
(0, typeorm_1.Column)({ type: Date }),
|
|
247
|
+
tslib_1.__metadata("design:type", Date)
|
|
248
|
+
], WorkShiftSegment.prototype, "validFrom", void 0);
|
|
249
|
+
tslib_1.__decorate([
|
|
250
|
+
(0, typeorm_1.Column)({ type: Date, nullable: true }),
|
|
251
|
+
tslib_1.__metadata("design:type", Date)
|
|
252
|
+
], WorkShiftSegment.prototype, "validTo", void 0);
|
|
253
|
+
exports.WorkShiftSegment = WorkShiftSegment = tslib_1.__decorate([
|
|
254
|
+
(0, typeorm_1.Entity)('work_shift_segment'),
|
|
255
|
+
(0, typeorm_1.Index)('ix_arrangement_segment_lookup', ['domain', 'arrangement', 'plan', 'validFrom']),
|
|
256
|
+
(0, typeorm_1.ForeignKey)('WorkShiftArrangement', ['domain', 'arrangement'], ['domain', 'id'], { onDelete: 'RESTRICT' }),
|
|
257
|
+
(0, typeorm_1.ForeignKey)(() => WorkShiftPlan, ['domain', 'arrangement', 'plan'], ['domain', 'arrangement', 'id'], { onDelete: 'RESTRICT' }),
|
|
258
|
+
(0, typeorm_1.ForeignKey)(() => WorkShiftRevision, ['domain', 'arrangement', 'revision'], ['domain', 'arrangement', 'id'], {
|
|
259
|
+
onDelete: 'RESTRICT'
|
|
260
|
+
})
|
|
261
|
+
], WorkShiftSegment);
|
|
262
|
+
/** Permanent evidence of the selected revision, also the retroactivity interlock. */
|
|
263
|
+
let WorkShiftBasis = class WorkShiftBasis {
|
|
264
|
+
};
|
|
265
|
+
exports.WorkShiftBasis = WorkShiftBasis;
|
|
266
|
+
tslib_1.__decorate([
|
|
267
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
268
|
+
tslib_1.__metadata("design:type", String)
|
|
269
|
+
], WorkShiftBasis.prototype, "id", void 0);
|
|
270
|
+
tslib_1.__decorate([
|
|
271
|
+
(0, typeorm_1.ManyToOne)(() => shell_1.Domain, { nullable: false }),
|
|
272
|
+
tslib_1.__metadata("design:type", shell_1.Domain)
|
|
273
|
+
], WorkShiftBasis.prototype, "domain", void 0);
|
|
274
|
+
tslib_1.__decorate([
|
|
275
|
+
(0, typeorm_1.RelationId)((row) => row.domain),
|
|
276
|
+
tslib_1.__metadata("design:type", String)
|
|
277
|
+
], WorkShiftBasis.prototype, "domainId", void 0);
|
|
278
|
+
tslib_1.__decorate([
|
|
279
|
+
(0, typeorm_1.ManyToOne)('WorkShiftArrangement', { nullable: false, createForeignKeyConstraints: false }),
|
|
280
|
+
tslib_1.__metadata("design:type", work_shift_arrangement_1.WorkShiftArrangement)
|
|
281
|
+
], WorkShiftBasis.prototype, "arrangement", void 0);
|
|
282
|
+
tslib_1.__decorate([
|
|
283
|
+
(0, typeorm_1.RelationId)((row) => row.arrangement),
|
|
284
|
+
tslib_1.__metadata("design:type", String)
|
|
285
|
+
], WorkShiftBasis.prototype, "arrangementId", void 0);
|
|
286
|
+
tslib_1.__decorate([
|
|
287
|
+
(0, typeorm_1.Column)('varchar'),
|
|
288
|
+
tslib_1.__metadata("design:type", String)
|
|
289
|
+
], WorkShiftBasis.prototype, "recordKey", void 0);
|
|
290
|
+
tslib_1.__decorate([
|
|
291
|
+
(0, typeorm_1.ManyToOne)(() => WorkShiftRevision, { nullable: false, createForeignKeyConstraints: false }),
|
|
292
|
+
tslib_1.__metadata("design:type", WorkShiftRevision)
|
|
293
|
+
], WorkShiftBasis.prototype, "revision", void 0);
|
|
294
|
+
tslib_1.__decorate([
|
|
295
|
+
(0, typeorm_1.RelationId)((row) => row.revision),
|
|
296
|
+
tslib_1.__metadata("design:type", String)
|
|
297
|
+
], WorkShiftBasis.prototype, "revisionId", void 0);
|
|
298
|
+
tslib_1.__decorate([
|
|
299
|
+
(0, typeorm_1.ManyToOne)(() => WorkShiftPlan, { nullable: false, createForeignKeyConstraints: false }),
|
|
300
|
+
tslib_1.__metadata("design:type", WorkShiftPlan)
|
|
301
|
+
], WorkShiftBasis.prototype, "plan", void 0);
|
|
302
|
+
tslib_1.__decorate([
|
|
303
|
+
(0, typeorm_1.RelationId)((row) => row.plan),
|
|
304
|
+
tslib_1.__metadata("design:type", String)
|
|
305
|
+
], WorkShiftBasis.prototype, "planId", void 0);
|
|
306
|
+
tslib_1.__decorate([
|
|
307
|
+
(0, typeorm_1.Column)('varchar'),
|
|
308
|
+
tslib_1.__metadata("design:type", String)
|
|
309
|
+
], WorkShiftBasis.prototype, "contentHash", void 0);
|
|
310
|
+
tslib_1.__decorate([
|
|
311
|
+
(0, typeorm_1.Column)({ type: Date }),
|
|
312
|
+
tslib_1.__metadata("design:type", Date)
|
|
313
|
+
], WorkShiftBasis.prototype, "businessTime", void 0);
|
|
314
|
+
tslib_1.__decorate([
|
|
315
|
+
(0, typeorm_1.Column)({ type: Date }),
|
|
316
|
+
tslib_1.__metadata("design:type", Date)
|
|
317
|
+
], WorkShiftBasis.prototype, "resolvedAt", void 0);
|
|
318
|
+
exports.WorkShiftBasis = WorkShiftBasis = tslib_1.__decorate([
|
|
319
|
+
(0, typeorm_1.Entity)('work_shift_basis'),
|
|
320
|
+
(0, typeorm_1.Index)('ix_work_shift_basis_domain', ['domain', 'id'], { unique: true }),
|
|
321
|
+
(0, typeorm_1.Index)('ix_arrangement_basis_owner', ['domain', 'arrangement', 'id'], { unique: true }),
|
|
322
|
+
(0, typeorm_1.Index)('ix_arrangement_basis_identity', ['domain', 'id', 'revision'], { unique: true }),
|
|
323
|
+
(0, typeorm_1.Index)('ix_arrangement_basis_record', ['domain', 'recordKey'], { unique: true }),
|
|
324
|
+
(0, typeorm_1.Index)('ix_arrangement_basis_time', ['domain', 'arrangement', 'businessTime']),
|
|
325
|
+
(0, typeorm_1.ForeignKey)('WorkShiftArrangement', ['domain', 'arrangement'], ['domain', 'id'], { onDelete: 'RESTRICT' }),
|
|
326
|
+
(0, typeorm_1.ForeignKey)(() => WorkShiftPlan, ['domain', 'arrangement', 'plan'], ['domain', 'arrangement', 'id'], { onDelete: 'RESTRICT' }),
|
|
327
|
+
(0, typeorm_1.ForeignKey)(() => WorkShiftRevision, ['domain', 'arrangement', 'revision'], ['domain', 'arrangement', 'id'], {
|
|
328
|
+
onDelete: 'RESTRICT'
|
|
329
|
+
})
|
|
330
|
+
], WorkShiftBasis);
|
|
331
|
+
exports.WORK_SHIFT_REVISION_ENTITIES = [
|
|
332
|
+
WorkShiftRevision,
|
|
333
|
+
WorkShiftPlan,
|
|
334
|
+
WorkShiftSegment,
|
|
335
|
+
WorkShiftBasis
|
|
336
|
+
];
|
|
337
|
+
//# sourceMappingURL=work-shift-revision.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"work-shift-revision.js","sour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,IAAI,EAAE,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACtF,IAAA,eAAK,EAAC,6BAA6B,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAC/E,IAAA,eAAK,EAAC,2BAA2B,EAAE,CAAC,QAAQ,EAAE,aAAa,EAAE,cAAc,CAAC,CAAC;IAC7E,IAAA,oBAAU,EAAC,sBAAsB,EAAE,CAAC,QAAQ,EAAE,aAAa,CAAC,EAAE,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;IACzG,IAAA,oBAAU,EAAC,GAAG,EAAE,CAAC,aAAa,EAAE,CAAC,QAAQ,EAAE,aAAa,EAAE,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,aAAa,EAAE,IAAI,CAAC,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;IAC7H,IAAA,oBAAU,EAAC,GAAG,EAAE,CAAC,iBAAiB,EAAE,CAAC,QAAQ,EAAE,aAAa,EAAE,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,aAAa,EAAE,IAAI,CAAC,EAAE;QAC3G,QAAQ,EAAE,UAAU;KACrB,CAAC;GACW,cAAc,CAsB1B;AAEY,QAAA,4BAA4B,GAAG;IAC1C,iBAAiB;IACjB,aAAa;IACb,gBAAgB;IAChB,cAAc;CACf,CAAA","sourcesContent":["import { Column, Entity, ForeignKey, Index, ManyToOne, PrimaryGeneratedColumn, RelationId } from 'typeorm'\nimport { Domain } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { WorkShiftArrangement } from './work-shift-arrangement'\nimport { MasterChangePolicy } from '@things-factory/ops-master'\n\n// Relations own the columns and RelationId exposes read-only identifiers.\n// Where a composite FK is declared, disable only the redundant single-column FK;\n// the database still enforces existence, domain and arrangement together.\n\n/** Content and the proposed effective date freeze together. Worklist owns the decision. */\n@Entity('work_shift_revisions')\n@Index('ix_arrangement_revision_subject', ['domain', 'arrangement', 'id'], { unique: true })\n@Index('ix_arrangement_revision_list', ['domain', 'arrangement', 'createdAt'])\n@ForeignKey(() => MasterChangePolicy, ['domain', 'policy'], ['domain', 'id'], { onDelete: 'RESTRICT' })\n@ForeignKey('WorkShiftArrangement', ['domain', 'arrangement'], ['domain', 'id'], { onDelete: 'RESTRICT' })\n@ForeignKey('WorkShiftRevision', ['domain', 'arrangement', 'baseRevision'], ['domain', 'arrangement', 'id'], {\n onDelete: 'RESTRICT'\n})\n@Index('ix_arrangement_revision_number', ['domain', 'arrangement', 'revisionNumber'], { unique: true })\nexport class WorkShiftRevision {\n /** Human revision number within one identity; assigned once under the subject write lock. */\n @Column('int') revisionNumber: number\n @ManyToOne(() => MasterChangePolicy, { nullable: false, createForeignKeyConstraints: false })\n policy: MasterChangePolicy\n @RelationId((row: WorkShiftRevision) => row.policy)\n policyId: string\n @PrimaryGeneratedColumn('uuid') id: string\n @ManyToOne(() => Domain, { nullable: false })\n domain: Domain\n @RelationId((row: WorkShiftRevision) => row.domain)\n domainId: string\n @ManyToOne('WorkShiftArrangement', { nullable: false, createForeignKeyConstraints: false })\n arrangement: WorkShiftArrangement\n @RelationId((row: WorkShiftRevision) => row.arrangement)\n arrangementId: string\n @ManyToOne(() => WorkShiftRevision, { nullable: true, createForeignKeyConstraints: false })\n baseRevision: WorkShiftRevision | null\n @RelationId((row: WorkShiftRevision) => row.baseRevision)\n baseRevisionId: string | null\n @Column('int') baseGeneration: number\n @Column('int', { default: 0 }) editGeneration: number\n @Column('text', { nullable: true }) description: string | null\n @Column() timezone: string\n @Column('simple-json') shifts: import('./work-shift-content').ShiftDefinition[]\n @Column({ type: Date }) effectiveFrom: Date\n @Column('text') reason: string\n /** Empty only on a baseline: nobody wrote it, it records the shifts as they already stood. */\n @ManyToOne(() => User, { nullable: true })\n creator: User | null\n @RelationId((row: WorkShiftRevision) => row.creator)\n creatorId: string | null\n @Column({ type: Date }) createdAt: Date\n @Column({ type: Date, nullable: true }) frozenAt: Date | null\n @Column('varchar', { nullable: true }) contentHash: string | null\n /** Opaque product decision ID: the common master module does not depend on worklist. */\n @Column('varchar', { nullable: true }) activityInstanceId: string | null\n}\n\n/** An append-only generation of the complete schedule for one arrangement. */\n@Entity('work_shift_plan')\n@Index('ix_arrangement_plan_generation', ['domain', 'arrangement', 'generation'], { unique: true })\n@Index('ix_arrangement_plan_identity', ['domain', 'arrangement', 'id'], { unique: true })\n@Index('ix_arrangement_plan_decision', ['activityInstanceId'], { unique: true })\n@Index('ix_arrangement_plan_publication', ['publishedRevision'], { unique: true })\n@ForeignKey(() => MasterChangePolicy, ['domain', 'policy'], ['domain', 'id'], { onDelete: 'RESTRICT' })\n@ForeignKey(() => WorkShiftRevision, ['domain', 'arrangement', 'publishedRevision'], ['domain', 'arrangement', 'id'], { onDelete: 'RESTRICT' })\n@ForeignKey('WorkShiftArrangement', ['domain', 'arrangement'], ['domain', 'id'], { onDelete: 'RESTRICT' })\nexport class WorkShiftPlan {\n @ManyToOne(() => MasterChangePolicy, { nullable: false, createForeignKeyConstraints: false })\n policy: MasterChangePolicy\n @RelationId((row: WorkShiftPlan) => row.policy)\n policyId: string\n @ManyToOne(() => WorkShiftRevision, { nullable: false, createForeignKeyConstraints: false })\n publishedRevision: WorkShiftRevision\n @RelationId((row: WorkShiftPlan) => row.publishedRevision)\n publishedRevisionId: string\n /** `baseline`: stood at boot from shifts that predate revisions. No approver, no publisher. */\n @Column('varchar') releaseKind: 'approved' | 'policy' | 'baseline'\n @ManyToOne(() => User, { nullable: true }) publisher: User | null\n @RelationId((row: WorkShiftPlan) => row.publisher) publisherId: string | null\n @PrimaryGeneratedColumn('uuid') id: string\n @ManyToOne(() => Domain, { nullable: false })\n domain: Domain\n @RelationId((row: WorkShiftPlan) => row.domain)\n domainId: string\n @ManyToOne('WorkShiftArrangement', { nullable: false, createForeignKeyConstraints: false })\n arrangement: WorkShiftArrangement\n @RelationId((row: WorkShiftPlan) => row.arrangement)\n arrangementId: string\n @Column('int') generation: number\n @Column({ type: Date }) recordedAt: Date\n @Column('varchar', { nullable: true }) activityInstanceId: string | null\n @ManyToOne(() => User, { nullable: true })\n approver: User\n @RelationId((row: WorkShiftPlan) => row.approver)\n approverId: string\n @Column('varchar') submissionHash: string\n}\n\n@Entity('work_shift_segment')\n@Index('ix_arrangement_segment_lookup', ['domain', 'arrangement', 'plan', 'validFrom'])\n@ForeignKey('WorkShiftArrangement', ['domain', 'arrangement'], ['domain', 'id'], { onDelete: 'RESTRICT' })\n@ForeignKey(() => WorkShiftPlan, ['domain', 'arrangement', 'plan'], ['domain', 'arrangement', 'id'], { onDelete: 'RESTRICT' })\n@ForeignKey(() => WorkShiftRevision, ['domain', 'arrangement', 'revision'], ['domain', 'arrangement', 'id'], {\n onDelete: 'RESTRICT'\n})\nexport class WorkShiftSegment {\n @PrimaryGeneratedColumn('uuid') id: string\n @ManyToOne(() => Domain, { nullable: false })\n domain: Domain\n @RelationId((row: WorkShiftSegment) => row.domain)\n domainId: string\n @ManyToOne('WorkShiftArrangement', { nullable: false, createForeignKeyConstraints: false })\n arrangement: WorkShiftArrangement\n @RelationId((row: WorkShiftSegment) => row.arrangement)\n arrangementId: string\n @ManyToOne(() => WorkShiftPlan, { nullable: false, createForeignKeyConstraints: false })\n plan: WorkShiftPlan\n @RelationId((row: WorkShiftSegment) => row.plan)\n planId: string\n @ManyToOne(() => WorkShiftRevision, { nullable: false, createForeignKeyConstraints: false })\n revision: WorkShiftRevision\n @RelationId((row: WorkShiftSegment) => row.revision)\n revisionId: string\n @Column({ type: Date }) validFrom: Date\n @Column({ type: Date, nullable: true }) validTo: Date | null\n}\n\n/** Permanent evidence of the selected revision, also the retroactivity interlock. */\n@Entity('work_shift_basis')\n@Index('ix_work_shift_basis_domain', ['domain', 'id'], { unique: true })\n@Index('ix_arrangement_basis_owner', ['domain', 'arrangement', 'id'], { unique: true })\n@Index('ix_arrangement_basis_identity', ['domain', 'id', 'revision'], { unique: true })\n@Index('ix_arrangement_basis_record', ['domain', 'recordKey'], { unique: true })\n@Index('ix_arrangement_basis_time', ['domain', 'arrangement', 'businessTime'])\n@ForeignKey('WorkShiftArrangement', ['domain', 'arrangement'], ['domain', 'id'], { onDelete: 'RESTRICT' })\n@ForeignKey(() => WorkShiftPlan, ['domain', 'arrangement', 'plan'], ['domain', 'arrangement', 'id'], { onDelete: 'RESTRICT' })\n@ForeignKey(() => WorkShiftRevision, ['domain', 'arrangement', 'revision'], ['domain', 'arrangement', 'id'], {\n onDelete: 'RESTRICT'\n})\nexport class WorkShiftBasis {\n @PrimaryGeneratedColumn('uuid') id: string\n @ManyToOne(() => Domain, { nullable: false })\n domain: Domain\n @RelationId((row: WorkShiftBasis) => row.domain)\n domainId: string\n @ManyToOne('WorkShiftArrangement', { nullable: false, createForeignKeyConstraints: false })\n arrangement: WorkShiftArrangement\n @RelationId((row: WorkShiftBasis) => row.arrangement)\n arrangementId: string\n @Column('varchar') recordKey: string\n @ManyToOne(() => WorkShiftRevision, { nullable: false, createForeignKeyConstraints: false })\n revision: WorkShiftRevision\n @RelationId((row: WorkShiftBasis) => row.revision)\n revisionId: string\n @ManyToOne(() => WorkShiftPlan, { nullable: false, createForeignKeyConstraints: false })\n plan: WorkShiftPlan\n @RelationId((row: WorkShiftBasis) => row.plan)\n planId: string\n @Column('varchar') contentHash: string\n @Column({ type: Date }) businessTime: Date\n @Column({ type: Date }) resolvedAt: Date\n}\n\nexport const WORK_SHIFT_REVISION_ENTITIES = [\n WorkShiftRevision,\n WorkShiftPlan,\n WorkShiftSegment,\n WorkShiftBasis\n]\n"]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 어느 벌이 그 시각의 답인가 — **순수 계산.** 데이터베이스를 만지지 않는다.
|
|
3
|
+
*
|
|
4
|
+
* ── 세 곳에 벌이 있다 ──────────────────────────────────────────────────────
|
|
5
|
+
* ```
|
|
6
|
+
* 지나간 것 revision effectiveFrom ≤ effectiveTo ≤ 지금
|
|
7
|
+
* 지금 것 WorkShift 가장 이른 createdAt 부터
|
|
8
|
+
* 예고된 것 revision effectiveFrom 이 미래 · effectiveTo 없음
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* ── 예고를 옮기지 않는다 ───────────────────────────────────────────────────
|
|
12
|
+
* 예고한 시각이 되면 **저절로 그 벌이 답이 된다.** 자정에 도는 일감이 편성을 옮기게 만들면, 그날 서버가
|
|
13
|
+
* 내려가 있는 경우 편성이 안 바뀌고 아무도 그것을 모른다. 시각으로 고르면 그런 창이 아예 없다.
|
|
14
|
+
*
|
|
15
|
+
* ── 늦게 시작한 벌이 이긴다 ────────────────────────────────────────────────
|
|
16
|
+
* 「10월 1일부터」와 「12월 1일부터」가 둘 다 있고 12월 5일을 물으면 뒤엣것이 답이다. 그래서 시작 시각이
|
|
17
|
+
* 늦은 것부터 본다.
|
|
18
|
+
*
|
|
19
|
+
* ── 모르는 것은 모른다고 한다 ──────────────────────────────────────────────
|
|
20
|
+
* 이력보다 앞선 시각은 이 시스템이 무엇을 쓰고 있었는지 모른다. 지금 편성으로 대신하면 그 시각의 사실이
|
|
21
|
+
* 있지도 않았던 교대 이름으로 읽힌다.
|
|
22
|
+
*/
|
|
23
|
+
export interface RevisionLike<T = unknown> {
|
|
24
|
+
effectiveFrom: Date;
|
|
25
|
+
/** 없으면 아직 끝나지 않은 벌이다(예고). */
|
|
26
|
+
effectiveTo?: Date | null;
|
|
27
|
+
shifts: T;
|
|
28
|
+
}
|
|
29
|
+
export type SetOrigin = 'current' | 'past' | 'announced' | 'unknown';
|
|
30
|
+
export interface SelectedSet<T = unknown> {
|
|
31
|
+
shifts: T | undefined;
|
|
32
|
+
origin: SetOrigin;
|
|
33
|
+
/** 고른 벌이 언제부터인가. 화면이 「예고분이 적용 중입니다」를 말하는 근거. */
|
|
34
|
+
from?: Date;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* 그 시각의 편성을 고른다.
|
|
38
|
+
*
|
|
39
|
+
* @param at 물어보는 시각
|
|
40
|
+
* @param currentShifts 지금 편집 중인 편성(`WorkShift`). 없으면 `undefined`
|
|
41
|
+
* @param currentSince 그 편성이 언제부터인가. 모르면 `undefined`
|
|
42
|
+
* @param revisions 지나간 것과 예고된 것 전부
|
|
43
|
+
*/
|
|
44
|
+
export declare function selectSetAt<T>(at: Date, currentShifts: T | undefined, currentSince: Date | undefined, revisions: RevisionLike<T>[]): SelectedSet<T>;
|
|
45
|
+
/**
|
|
46
|
+
* 아직 시작하지 않은 벌들 — 화면이 「예고된 편성」으로 보여 줄 것.
|
|
47
|
+
*
|
|
48
|
+
* 시작이 이른 것부터. 사람이 「다음에 무엇이 오나」를 읽는 차례다.
|
|
49
|
+
*/
|
|
50
|
+
export declare function announcedSets<T>(now: Date, revisions: RevisionLike<T>[]): RevisionLike<T>[];
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* 어느 벌이 그 시각의 답인가 — **순수 계산.** 데이터베이스를 만지지 않는다.
|
|
4
|
+
*
|
|
5
|
+
* ── 세 곳에 벌이 있다 ──────────────────────────────────────────────────────
|
|
6
|
+
* ```
|
|
7
|
+
* 지나간 것 revision effectiveFrom ≤ effectiveTo ≤ 지금
|
|
8
|
+
* 지금 것 WorkShift 가장 이른 createdAt 부터
|
|
9
|
+
* 예고된 것 revision effectiveFrom 이 미래 · effectiveTo 없음
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* ── 예고를 옮기지 않는다 ───────────────────────────────────────────────────
|
|
13
|
+
* 예고한 시각이 되면 **저절로 그 벌이 답이 된다.** 자정에 도는 일감이 편성을 옮기게 만들면, 그날 서버가
|
|
14
|
+
* 내려가 있는 경우 편성이 안 바뀌고 아무도 그것을 모른다. 시각으로 고르면 그런 창이 아예 없다.
|
|
15
|
+
*
|
|
16
|
+
* ── 늦게 시작한 벌이 이긴다 ────────────────────────────────────────────────
|
|
17
|
+
* 「10월 1일부터」와 「12월 1일부터」가 둘 다 있고 12월 5일을 물으면 뒤엣것이 답이다. 그래서 시작 시각이
|
|
18
|
+
* 늦은 것부터 본다.
|
|
19
|
+
*
|
|
20
|
+
* ── 모르는 것은 모른다고 한다 ──────────────────────────────────────────────
|
|
21
|
+
* 이력보다 앞선 시각은 이 시스템이 무엇을 쓰고 있었는지 모른다. 지금 편성으로 대신하면 그 시각의 사실이
|
|
22
|
+
* 있지도 않았던 교대 이름으로 읽힌다.
|
|
23
|
+
*/
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.selectSetAt = selectSetAt;
|
|
26
|
+
exports.announcedSets = announcedSets;
|
|
27
|
+
/**
|
|
28
|
+
* 그 시각의 편성을 고른다.
|
|
29
|
+
*
|
|
30
|
+
* @param at 물어보는 시각
|
|
31
|
+
* @param currentShifts 지금 편집 중인 편성(`WorkShift`). 없으면 `undefined`
|
|
32
|
+
* @param currentSince 그 편성이 언제부터인가. 모르면 `undefined`
|
|
33
|
+
* @param revisions 지나간 것과 예고된 것 전부
|
|
34
|
+
*/
|
|
35
|
+
function selectSetAt(at, currentShifts, currentSince, revisions) {
|
|
36
|
+
/* 시작한 벌만 후보다. 시작 시각이 늦은 것부터 본다 — 늦게 시작한 벌이 이긴다. */
|
|
37
|
+
const started = revisions
|
|
38
|
+
.filter(revision => revision.effectiveFrom <= at)
|
|
39
|
+
.sort((a, b) => b.effectiveFrom.getTime() - a.effectiveFrom.getTime());
|
|
40
|
+
const covering = started.find(revision => !revision.effectiveTo || revision.effectiveTo > at);
|
|
41
|
+
if (covering) {
|
|
42
|
+
return {
|
|
43
|
+
shifts: covering.shifts,
|
|
44
|
+
/* 끝이 없는 벌이 지금을 덮고 있으면 그것은 예고했던 것이 적용 중인 것이다. */
|
|
45
|
+
origin: covering.effectiveTo ? 'past' : 'announced',
|
|
46
|
+
from: covering.effectiveFrom
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
if (currentShifts !== undefined && (!currentSince || at >= currentSince)) {
|
|
50
|
+
return { shifts: currentShifts, origin: 'current', from: currentSince };
|
|
51
|
+
}
|
|
52
|
+
/* 이력보다 앞선 시각이다. 무엇을 쓰고 있었는지 모른다. */
|
|
53
|
+
return { shifts: undefined, origin: 'unknown' };
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* 아직 시작하지 않은 벌들 — 화면이 「예고된 편성」으로 보여 줄 것.
|
|
57
|
+
*
|
|
58
|
+
* 시작이 이른 것부터. 사람이 「다음에 무엇이 오나」를 읽는 차례다.
|
|
59
|
+
*/
|
|
60
|
+
function announcedSets(now, revisions) {
|
|
61
|
+
return revisions
|
|
62
|
+
.filter(revision => revision.effectiveFrom > now)
|
|
63
|
+
.sort((a, b) => a.effectiveFrom.getTime() - b.effectiveFrom.getTime());
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=work-shift-selection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"work-shift-selection.js","sourceRoot":"","sources":["../../../server/service/work-shift/work-shift-selection.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;AA0BH,kCA4BC;AAOD,sCAIC;AA/CD;;;;;;;GAOG;AACH,SAAgB,WAAW,CACzB,EAAQ,EACR,aAA4B,EAC5B,YAA8B,EAC9B,SAA4B;IAE5B,mDAAmD;IACnD,MAAM,OAAO,GAAG,SAAS;SACtB,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,aAAa,IAAI,EAAE,CAAC;SAChD,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC,CAAA;IAExE,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,WAAW,IAAI,QAAQ,CAAC,WAAW,GAAG,EAAE,CAAC,CAAA;IAE7F,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO;YACL,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,gDAAgD;YAChD,MAAM,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW;YACnD,IAAI,EAAE,QAAQ,CAAC,aAAa;SAC7B,CAAA;IACH,CAAC;IAED,IAAI,aAAa,KAAK,SAAS,IAAI,CAAC,CAAC,YAAY,IAAI,EAAE,IAAI,YAAY,CAAC,EAAE,CAAC;QACzE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,EAAE,CAAA;IACzE,CAAC;IAED,oCAAoC;IACpC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,CAAA;AACjD,CAAC;AAED;;;;GAIG;AACH,SAAgB,aAAa,CAAI,GAAS,EAAE,SAA4B;IACtE,OAAO,SAAS;SACb,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,aAAa,GAAG,GAAG,CAAC;SAChD,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC,CAAA;AAC1E,CAAC","sourcesContent":["/**\n * 어느 벌이 그 시각의 답인가 — **순수 계산.** 데이터베이스를 만지지 않는다.\n *\n * ── 세 곳에 벌이 있다 ──────────────────────────────────────────────────────\n * ```\n * 지나간 것 revision effectiveFrom ≤ effectiveTo ≤ 지금\n * 지금 것 WorkShift 가장 이른 createdAt 부터\n * 예고된 것 revision effectiveFrom 이 미래 · effectiveTo 없음\n * ```\n *\n * ── 예고를 옮기지 않는다 ───────────────────────────────────────────────────\n * 예고한 시각이 되면 **저절로 그 벌이 답이 된다.** 자정에 도는 일감이 편성을 옮기게 만들면, 그날 서버가\n * 내려가 있는 경우 편성이 안 바뀌고 아무도 그것을 모른다. 시각으로 고르면 그런 창이 아예 없다.\n *\n * ── 늦게 시작한 벌이 이긴다 ────────────────────────────────────────────────\n * 「10월 1일부터」와 「12월 1일부터」가 둘 다 있고 12월 5일을 물으면 뒤엣것이 답이다. 그래서 시작 시각이\n * 늦은 것부터 본다.\n *\n * ── 모르는 것은 모른다고 한다 ──────────────────────────────────────────────\n * 이력보다 앞선 시각은 이 시스템이 무엇을 쓰고 있었는지 모른다. 지금 편성으로 대신하면 그 시각의 사실이\n * 있지도 않았던 교대 이름으로 읽힌다.\n */\n\nexport interface RevisionLike<T = unknown> {\n effectiveFrom: Date\n /** 없으면 아직 끝나지 않은 벌이다(예고). */\n effectiveTo?: Date | null\n shifts: T\n}\n\nexport type SetOrigin = 'current' | 'past' | 'announced' | 'unknown'\n\nexport interface SelectedSet<T = unknown> {\n shifts: T | undefined\n origin: SetOrigin\n /** 고른 벌이 언제부터인가. 화면이 「예고분이 적용 중입니다」를 말하는 근거. */\n from?: Date\n}\n\n/**\n * 그 시각의 편성을 고른다.\n *\n * @param at 물어보는 시각\n * @param currentShifts 지금 편집 중인 편성(`WorkShift`). 없으면 `undefined`\n * @param currentSince 그 편성이 언제부터인가. 모르면 `undefined`\n * @param revisions 지나간 것과 예고된 것 전부\n */\nexport function selectSetAt<T>(\n at: Date,\n currentShifts: T | undefined,\n currentSince: Date | undefined,\n revisions: RevisionLike<T>[]\n): SelectedSet<T> {\n /* 시작한 벌만 후보다. 시작 시각이 늦은 것부터 본다 — 늦게 시작한 벌이 이긴다. */\n const started = revisions\n .filter(revision => revision.effectiveFrom <= at)\n .sort((a, b) => b.effectiveFrom.getTime() - a.effectiveFrom.getTime())\n\n const covering = started.find(revision => !revision.effectiveTo || revision.effectiveTo > at)\n\n if (covering) {\n return {\n shifts: covering.shifts,\n /* 끝이 없는 벌이 지금을 덮고 있으면 그것은 예고했던 것이 적용 중인 것이다. */\n origin: covering.effectiveTo ? 'past' : 'announced',\n from: covering.effectiveFrom\n }\n }\n\n if (currentShifts !== undefined && (!currentSince || at >= currentSince)) {\n return { shifts: currentShifts, origin: 'current', from: currentSince }\n }\n\n /* 이력보다 앞선 시각이다. 무엇을 쓰고 있었는지 모른다. */\n return { shifts: undefined, origin: 'unknown' }\n}\n\n/**\n * 아직 시작하지 않은 벌들 — 화면이 「예고된 편성」으로 보여 줄 것.\n *\n * 시작이 이른 것부터. 사람이 「다음에 무엇이 오나」를 읽는 차례다.\n */\nexport function announcedSets<T>(now: Date, revisions: RevisionLike<T>[]): RevisionLike<T>[] {\n return revisions\n .filter(revision => revision.effectiveFrom > now)\n .sort((a, b) => a.effectiveFrom.getTime() - b.effectiveFrom.getTime())\n}\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { WorkShift, WorkShiftDateType } from './work-shift';
|
|
2
|
+
export declare class WorkShiftPatch {
|
|
3
|
+
name: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
fromDate: WorkShiftDateType;
|
|
6
|
+
fromTime: string;
|
|
7
|
+
toDate: WorkShiftDateType;
|
|
8
|
+
toTime: string;
|
|
9
|
+
/**
|
|
10
|
+
* Which weekdays this shift runs on — 0 Sunday … 6 Saturday, empty for every day.
|
|
11
|
+
*
|
|
12
|
+
* Nullable so that a client written before this field existed keeps working: an
|
|
13
|
+
* absent value means every day, which is exactly what those clients meant.
|
|
14
|
+
*/
|
|
15
|
+
daysOfWeek?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare class WorkShiftList {
|
|
18
|
+
items: WorkShift[];
|
|
19
|
+
total: number;
|
|
20
|
+
}
|
|
21
|
+
export declare class WorkShiftInfo {
|
|
22
|
+
workDate?: string;
|
|
23
|
+
workShift?: string;
|
|
24
|
+
dateRange?: Date[];
|
|
25
|
+
shiftRange?: Date[];
|
|
26
|
+
}
|