@shisyamo4131/air-guard-v2-schemas 2.4.2-dev.12 → 2.4.2-dev.14
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 +1 -1
- package/src/Operation.js +14 -14
- package/src/SiteOperationSchedule.js +1 -1
- package/src/SiteOperationScheduleDetail.js +30 -33
- package/src/User.js +3 -1
package/package.json
CHANGED
package/src/Operation.js
CHANGED
|
@@ -221,7 +221,7 @@ export default class Operation extends WorkingResult {
|
|
|
221
221
|
constructor(item = {}) {
|
|
222
222
|
if (new.target == Operation) {
|
|
223
223
|
throw new Error(
|
|
224
|
-
`Operation is an abstract class and cannot be instantiated directly
|
|
224
|
+
`Operation is an abstract class and cannot be instantiated directly.`,
|
|
225
225
|
);
|
|
226
226
|
}
|
|
227
227
|
super(item);
|
|
@@ -367,7 +367,7 @@ export default class Operation extends WorkingResult {
|
|
|
367
367
|
set(v) {
|
|
368
368
|
if (typeof v !== "number" || isNaN(v) || v < 0) {
|
|
369
369
|
throw new Error(
|
|
370
|
-
`regulationWorkMinutes must be a non-negative number. regulationWorkMinutes: ${v}
|
|
370
|
+
`regulationWorkMinutes must be a non-negative number. regulationWorkMinutes: ${v}`,
|
|
371
371
|
);
|
|
372
372
|
}
|
|
373
373
|
if (_regulationWorkMinutes === v) return;
|
|
@@ -456,7 +456,7 @@ export default class Operation extends WorkingResult {
|
|
|
456
456
|
const { id } = args;
|
|
457
457
|
if (!id || typeof id !== "string") {
|
|
458
458
|
throw new Error(
|
|
459
|
-
`Employee ID is required and must be a string. id: ${id}
|
|
459
|
+
`Employee ID is required and must be a string. id: ${id}`,
|
|
460
460
|
);
|
|
461
461
|
}
|
|
462
462
|
if (this.some((emp) => emp.workerId === id)) {
|
|
@@ -467,7 +467,7 @@ export default class Operation extends WorkingResult {
|
|
|
467
467
|
throw new Error("employees.customClass is not defined.");
|
|
468
468
|
}
|
|
469
469
|
const newEmployee = new schema({
|
|
470
|
-
...self.toObject(),
|
|
470
|
+
...self.toObject(), // 自身のプロパティを継承(siteId, dateAt, shiftType, startTime, endTime, breakMinutes など)
|
|
471
471
|
...args,
|
|
472
472
|
isEmployee: true, // Force override to true
|
|
473
473
|
});
|
|
@@ -490,7 +490,7 @@ export default class Operation extends WorkingResult {
|
|
|
490
490
|
value: function (oldIndex, newIndex) {
|
|
491
491
|
if (newIndex > this.length - 1) {
|
|
492
492
|
throw new Error(
|
|
493
|
-
`Employees must be placed before outsourcers. newIndex: ${newIndex}, employees.length: ${this.length}
|
|
493
|
+
`Employees must be placed before outsourcers. newIndex: ${newIndex}, employees.length: ${this.length}`,
|
|
494
494
|
);
|
|
495
495
|
}
|
|
496
496
|
if (newIndex < 0 || newIndex >= this.length) {
|
|
@@ -510,7 +510,7 @@ export default class Operation extends WorkingResult {
|
|
|
510
510
|
change: {
|
|
511
511
|
value: function (newEmployee) {
|
|
512
512
|
const index = this.findIndex(
|
|
513
|
-
(e) => e.workerId === newEmployee.workerId
|
|
513
|
+
(e) => e.workerId === newEmployee.workerId,
|
|
514
514
|
);
|
|
515
515
|
if (index < 0) {
|
|
516
516
|
throw new Error("Worker not found in employees.");
|
|
@@ -559,7 +559,7 @@ export default class Operation extends WorkingResult {
|
|
|
559
559
|
const { id } = args;
|
|
560
560
|
if (!id || typeof id !== "string") {
|
|
561
561
|
throw new Error(
|
|
562
|
-
`Outsourcer ID is required and must be a string. id: ${id}
|
|
562
|
+
`Outsourcer ID is required and must be a string. id: ${id}`,
|
|
563
563
|
);
|
|
564
564
|
}
|
|
565
565
|
const maxIndex = this.reduce((result, out) => {
|
|
@@ -600,16 +600,16 @@ export default class Operation extends WorkingResult {
|
|
|
600
600
|
value: function (oldIndex, newIndex) {
|
|
601
601
|
if (newIndex <= self.employees.length - 1) {
|
|
602
602
|
throw new Error(
|
|
603
|
-
`Outsourcers must be placed after employees. newIndex: ${newIndex}, employees.length: ${self.employees.length}
|
|
603
|
+
`Outsourcers must be placed after employees. newIndex: ${newIndex}, employees.length: ${self.employees.length}`,
|
|
604
604
|
);
|
|
605
605
|
}
|
|
606
606
|
const internalOldIndex = Math.max(
|
|
607
607
|
0,
|
|
608
|
-
oldIndex - self.employees.length
|
|
608
|
+
oldIndex - self.employees.length,
|
|
609
609
|
);
|
|
610
610
|
const internalNewIndex = Math.max(
|
|
611
611
|
0,
|
|
612
|
-
newIndex - self.employees.length
|
|
612
|
+
newIndex - self.employees.length,
|
|
613
613
|
);
|
|
614
614
|
if (internalOldIndex < 0 || internalOldIndex >= this.length) {
|
|
615
615
|
throw new Error(`Invalid old index: ${internalOldIndex}`);
|
|
@@ -631,7 +631,7 @@ export default class Operation extends WorkingResult {
|
|
|
631
631
|
change: {
|
|
632
632
|
value: function (newOutsourcer) {
|
|
633
633
|
const index = this.findIndex(
|
|
634
|
-
(e) => e.workerId === newOutsourcer.workerId
|
|
634
|
+
(e) => e.workerId === newOutsourcer.workerId,
|
|
635
635
|
);
|
|
636
636
|
if (index < 0) {
|
|
637
637
|
throw new Error("Worker not found in outsourcers.");
|
|
@@ -781,7 +781,7 @@ export default class Operation extends WorkingResult {
|
|
|
781
781
|
const { oldIndex, newIndex, isEmployee = true } = options;
|
|
782
782
|
if (typeof oldIndex !== "number" || typeof newIndex !== "number") {
|
|
783
783
|
throw new Error(
|
|
784
|
-
"oldIndex and newIndex are required and must be numbers."
|
|
784
|
+
"oldIndex and newIndex are required and must be numbers.",
|
|
785
785
|
);
|
|
786
786
|
}
|
|
787
787
|
if (isEmployee) {
|
|
@@ -831,7 +831,7 @@ export default class Operation extends WorkingResult {
|
|
|
831
831
|
case "object":
|
|
832
832
|
if (!key.siteId || !key.shiftType || !key.date) {
|
|
833
833
|
throw new Error(
|
|
834
|
-
"key must contain siteId, shiftType, and date properties."
|
|
834
|
+
"key must contain siteId, shiftType, and date properties.",
|
|
835
835
|
);
|
|
836
836
|
}
|
|
837
837
|
return [key.siteId, key.shiftType, key.date];
|
|
@@ -839,7 +839,7 @@ export default class Operation extends WorkingResult {
|
|
|
839
839
|
const [siteId, shiftType, year, month, day] = key.split("-");
|
|
840
840
|
if (!siteId || !shiftType || !year || !month || !day) {
|
|
841
841
|
throw new Error(
|
|
842
|
-
"key must be in the format 'siteId-shiftType-year-month-day'."
|
|
842
|
+
"key must be in the format 'siteId-shiftType-year-month-day'.",
|
|
843
843
|
);
|
|
844
844
|
}
|
|
845
845
|
return [siteId, shiftType, `${year}-${month}-${day}`];
|
|
@@ -395,7 +395,7 @@ export default class SiteOperationSchedule extends Operation {
|
|
|
395
395
|
* Returns whether all workers have been notified.
|
|
396
396
|
* @returns {boolean} - Whether all workers have been notified.
|
|
397
397
|
*/
|
|
398
|
-
get
|
|
398
|
+
get isNotifiedAllWorkers() {
|
|
399
399
|
return this.workers.every((worker) => worker.hasNotification);
|
|
400
400
|
}
|
|
401
401
|
|
|
@@ -5,46 +5,43 @@
|
|
|
5
5
|
* - Model representing the details of a site operation schedule.
|
|
6
6
|
* - Inherits from OperationDetail.
|
|
7
7
|
* ---------------------------------------------------------------------------
|
|
8
|
-
* @
|
|
9
|
-
* @
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* - Concatenation of `siteOperationScheduleId` and `workerId` with '-'
|
|
8
|
+
* @property {string} siteOperationScheduleId - Site Operation Schedule ID
|
|
9
|
+
* @property {boolean} hasNotification - 配置通知が作成されているかどうかのフラグ。SiteOperationSchedule クラスから設定される。
|
|
10
|
+
* @property {string} notificationKey - Notification key (read-only)
|
|
11
|
+
* - `siteOperationScheduleId` と `workerId` を `-` で連結したキー。`ArrangemntNotification` ドキュメントIDと一致する。
|
|
13
12
|
* ---------------------------------------------------------------------------
|
|
14
13
|
* @inherited - The following properties are inherited from OperationDetail:
|
|
15
|
-
* @
|
|
16
|
-
* @
|
|
17
|
-
* @
|
|
18
|
-
* @
|
|
19
|
-
* @
|
|
20
|
-
* @
|
|
21
|
-
* @
|
|
22
|
-
*
|
|
23
|
-
* @inherited - The following computed properties are inherited from OperationDetail:
|
|
24
|
-
* @computed {string} workerId - Worker ID (read-only)
|
|
14
|
+
* @property {string} id - Employee or Outsourcer document ID
|
|
15
|
+
* @property {number} index - Identifier index for Outsourcer (always 0 for Employee)
|
|
16
|
+
* @property {boolean} isEmployee - Employee flag (true: Employee, false: Outsourcer)
|
|
17
|
+
* @property {number} amount - Number of placements (always fixed at 1)
|
|
18
|
+
* @property {string} siteId - Site ID
|
|
19
|
+
* @property {boolean} isQualified - Qualified flag
|
|
20
|
+
* @property {boolean} isOjt - OJT flag
|
|
21
|
+
* @property {string} workerId - Worker ID (read-only)
|
|
25
22
|
* - For Employee, it's the same as `id`, for Outsourcer, it's a concatenation of `id` and `index` with ':'
|
|
26
|
-
* @
|
|
27
|
-
* @
|
|
23
|
+
* @property {string|null} employeeId - Employee ID (null if not applicable) (read-only)
|
|
24
|
+
* @property {string|null} outsourcerId - Outsourcer ID (null if not applicable) (read-only)
|
|
28
25
|
* ---------------------------------------------------------------------------
|
|
29
26
|
* @inherited - The following properties are inherited from WorkingResult (via OperationDetail):
|
|
30
|
-
* @
|
|
31
|
-
* @
|
|
32
|
-
* @
|
|
33
|
-
* @
|
|
34
|
-
* @
|
|
35
|
-
* @
|
|
36
|
-
* @
|
|
37
|
-
* @
|
|
27
|
+
* @property {Date} dateAt - Placement date (trigger property)
|
|
28
|
+
* @property {string} dayType - Day type (e.g., `WEEKDAY`, `WEEKEND`, `HOLIDAY`)
|
|
29
|
+
* @property {string} shiftType - `DAY` or `NIGHT`
|
|
30
|
+
* @property {string} startTime - Start time (HH:MM format)
|
|
31
|
+
* @property {boolean} isStartNextDay - Next day start flag
|
|
32
|
+
* @property {string} endTime - End time (HH:MM format)
|
|
33
|
+
* @property {number} breakMinutes - Break time (minutes)
|
|
34
|
+
* @property {number} regulationWorkMinutes - Regulation work minutes
|
|
38
35
|
* ---------------------------------------------------------------------------
|
|
39
36
|
* @inherited - The following computed properties are inherited from WorkingResult (via OperationDetail):
|
|
40
|
-
* @
|
|
41
|
-
* @
|
|
42
|
-
* @
|
|
43
|
-
* @
|
|
44
|
-
* @
|
|
45
|
-
* @
|
|
46
|
-
* @
|
|
47
|
-
* @
|
|
37
|
+
* @property {string} key - Unique key combining `date`, `dayType`, and `shiftType` (read-only)
|
|
38
|
+
* @property {string} date - Date string in YYYY-MM-DD format based on `dateAt` (read-only)
|
|
39
|
+
* @property {boolean} isSpansNextDay - Flag indicating whether the date spans from start date to end date (read-only)
|
|
40
|
+
* @property {Date} startAt - Start date and time (Date object) (read-only)
|
|
41
|
+
* @property {Date} endAt - End date and time (Date object) (read-only)
|
|
42
|
+
* @property {number} totalWorkMinutes - Total working time in minutes (excluding break time) (read-only)
|
|
43
|
+
* @property {number} regularTimeWorkMinutes - Regular working time in minutes (read-only)
|
|
44
|
+
* @property {number} overtimeWorkMinutes - Overtime work in minutes (read-only)
|
|
48
45
|
* - Calculated as `totalWorkMinutes` minus `regulationWorkMinutes`
|
|
49
46
|
* - Overtime work is not negative; the minimum is 0.
|
|
50
47
|
* ---------------------------------------------------------------------------
|