@shisyamo4131/air-guard-v2-schemas 2.4.2-dev.9 → 2.4.2-dev.91

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/index.js +12 -0
  2. package/package.json +45 -47
  3. package/src/Agreement.js +17 -24
  4. package/src/AgreementV2.js +185 -0
  5. package/src/ArrangementNotification.js +16 -8
  6. package/src/Billing.js +6 -35
  7. package/src/Company.js +162 -25
  8. package/src/Customer.js +41 -60
  9. package/src/Employee.js +590 -300
  10. package/src/FcmToken.js +73 -0
  11. package/src/Insurance.js +409 -0
  12. package/src/Notification.js +95 -0
  13. package/src/NotificationRecipient.js +68 -0
  14. package/src/Operation.js +273 -281
  15. package/src/OperationBilling.js +126 -192
  16. package/src/OperationDetail.js +115 -85
  17. package/src/OperationResult.js +257 -254
  18. package/src/OperationResultDetail.js +65 -56
  19. package/src/Outsourcer.js +1 -1
  20. package/src/Site.js +160 -137
  21. package/src/SiteOperationSchedule.js +187 -247
  22. package/src/SiteOperationScheduleDetail.js +75 -65
  23. package/src/SiteOrder.js +18 -29
  24. package/src/User.js +44 -47
  25. package/src/WorkTimeBase.js +205 -0
  26. package/src/WorkingResult.js +83 -255
  27. package/src/constants/arrangement-notification-status.js +91 -4
  28. package/src/constants/day-type.js +20 -12
  29. package/src/constants/employment-status.js +2 -2
  30. package/src/constants/index.js +8 -0
  31. package/src/constants/insurance-status.js +15 -0
  32. package/src/constants/security-type.js +16 -0
  33. package/src/constants/shift-type.js +5 -2
  34. package/src/errorDefinitions.js +173 -0
  35. package/src/parts/fieldDefinitions/array.js +50 -0
  36. package/src/parts/fieldDefinitions/check.js +53 -0
  37. package/src/parts/fieldDefinitions/code.js +8 -0
  38. package/src/parts/fieldDefinitions/constants.js +9 -0
  39. package/src/parts/fieldDefinitions/dateAt.js +63 -0
  40. package/src/parts/fieldDefinitions/dateTimeAt.js +8 -0
  41. package/src/parts/fieldDefinitions/defaultDefinition.js +118 -0
  42. package/src/parts/fieldDefinitions/multipleLine.js +16 -0
  43. package/src/parts/fieldDefinitions/number.js +69 -0
  44. package/src/parts/fieldDefinitions/object.js +38 -0
  45. package/src/parts/fieldDefinitions/oneLine.js +426 -0
  46. package/src/parts/fieldDefinitions/radio.js +8 -0
  47. package/src/parts/fieldDefinitions/select.js +282 -0
  48. package/src/parts/fieldDefinitions/time.js +8 -0
  49. package/src/parts/fieldDefinitions.js +46 -669
  50. package/src/utils/CutoffDate.js +11 -15
  51. package/src/utils/index.js +44 -8
package/index.js CHANGED
@@ -1,4 +1,11 @@
1
+ import { RateSet } from "./src/AgreementV2.js";
2
+
1
3
  export { default as Agreement } from "./src/Agreement.js";
4
+ export {
5
+ default as AgreementV2,
6
+ RateSet,
7
+ DayTypeRates,
8
+ } from "./src/AgreementV2.js";
2
9
  export { default as ArrangementNotification } from "./src/ArrangementNotification.js";
3
10
  export { default as Billing } from "./src/Billing.js";
4
11
  export { default as Certification } from "./src/Certification.js";
@@ -6,7 +13,12 @@ export { default as Company } from "./src/Company.js";
6
13
  export { default as Customer, CustomerMinimal } from "./src/Customer.js";
7
14
  export { default as CutoffDate } from "./src/utils/CutoffDate.js";
8
15
  export { default as Employee } from "./src/Employee.js";
16
+ export { VALIDATION_ERRORS } from "./src/errorDefinitions.js";
17
+ export { default as FcmToken } from "./src/FcmToken.js";
9
18
  export { GeocodableMixin } from "./src/mixins/GeocodableMixin.js";
19
+ export { default as Insurance } from "./src/Insurance.js";
20
+ export { default as Notification } from "./src/Notification.js";
21
+ export { default as NotificationRecipient } from "./src/NotificationRecipient.js";
10
22
  export { default as OperationBilling } from "./src/OperationBilling.js";
11
23
  export { default as OperationResult } from "./src/OperationResult.js";
12
24
  export { default as OperationResultDetail } from "./src/OperationResultDetail.js";
package/package.json CHANGED
@@ -1,47 +1,45 @@
1
- {
2
- "name": "@shisyamo4131/air-guard-v2-schemas",
3
- "version": "2.4.2-dev.9",
4
- "description": "Schemas for AirGuard V2",
5
- "type": "module",
6
- "main": "index.js",
7
- "exports": {
8
- ".": "./index.js",
9
- "./constants": "./src/constants/index.js",
10
- "./apis": "./src/apis/index.js",
11
- "./utils": "./src/utils/index.js"
12
- },
13
- "files": [
14
- "index.js",
15
- "src/**/*.js",
16
- "!**/*.test.js",
17
- "!**/*.spec.js",
18
- "README.md"
19
- ],
20
- "keywords": [
21
- "airguard",
22
- "schemas",
23
- "firestore",
24
- "models"
25
- ],
26
- "author": "shisyamo4131",
27
- "license": "ISC",
28
- "repository": {
29
- "type": "git",
30
- "url": "https://github.com/shisyamo4131/air-guard-v2-schemas.git"
31
- },
32
- "publishConfig": {
33
- "access": "public"
34
- },
35
- "scripts": {
36
- "dev:publish": "npm version prerelease --preid=dev && npm publish --tag dev",
37
- "release:patch": "npm version patch && npm publish",
38
- "release:minor": "npm version minor && npm publish",
39
- "release:major": "npm version major && npm publish"
40
- },
41
- "peerDependencies": {
42
- "@shisyamo4131/air-firebase-v2": "^2.1.0"
43
- },
44
- "dependencies": {
45
- "@holiday-jp/holiday_jp": "^2.5.1"
46
- }
47
- }
1
+ {
2
+ "name": "@shisyamo4131/air-guard-v2-schemas",
3
+ "version": "2.4.2-dev.91",
4
+ "description": "Schemas for AirGuard V2",
5
+ "type": "module",
6
+ "main": "index.js",
7
+ "exports": {
8
+ ".": "./index.js",
9
+ "./constants": "./src/constants/index.js",
10
+ "./apis": "./src/apis/index.js",
11
+ "./utils": "./src/utils/index.js"
12
+ },
13
+ "files": [
14
+ "index.js",
15
+ "src/**/*.js",
16
+ "!**/*.test.js",
17
+ "!**/*.spec.js",
18
+ "README.md"
19
+ ],
20
+ "keywords": [
21
+ "airguard",
22
+ "schemas",
23
+ "firestore",
24
+ "models"
25
+ ],
26
+ "author": "shisyamo4131",
27
+ "license": "ISC",
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "https://github.com/shisyamo4131/air-guard-v2-schemas.git"
31
+ },
32
+ "publishConfig": {
33
+ "access": "public"
34
+ },
35
+ "scripts": {
36
+ "dev:publish": "npm version prerelease --preid=dev && npm publish --tag dev",
37
+ "release:patch": "npm version patch && npm publish",
38
+ "release:minor": "npm version minor && npm publish",
39
+ "release:major": "npm version major && npm publish"
40
+ },
41
+ "peerDependencies": {
42
+ "@holiday-jp/holiday_jp": "^2.5.1",
43
+ "@shisyamo4131/air-firebase-v2": "^2.3.1-dev.3"
44
+ }
45
+ }
package/src/Agreement.js CHANGED
@@ -1,9 +1,12 @@
1
1
  /*****************************************************************************
2
- * Agreement Model ver 1.0.0
2
+ * @deprecated
3
+ * 取極めモデルクラス
3
4
  * @author shisyamo4131
4
- * ---------------------------------------------------------------------------
5
- * A class to manage agreement details based on WorkingResult.
6
- * ---------------------------------------------------------------------------
5
+ *
6
+ * @constant {Object} BILLING_UNIT_TYPE - 請求単位定数オブジェクト
7
+ * @constant {Object} DAY_TYPE - 曜日区分定数オブジェクト
8
+ * @constant {Object} SHIFT_TYPE - シフト区分定数オブジェクト
9
+ *
7
10
  * @property {number} unitPriceBase - Base unit price (JPY)
8
11
  * @property {number} overtimeUnitPriceBase - Overtime unit price (JPY/hour)
9
12
  * @property {number} unitPriceQualified - Qualified unit price (JPY)
@@ -36,26 +39,26 @@
36
39
  *
37
40
  * @property {string} key - {@link WorkingResult#key}
38
41
  *
39
- * @computed {string} date - Date string in YYYY-MM-DD format based on `dateAt` (read-only)
42
+ * @property {string} date - Date string in YYYY-MM-DD format based on `dateAt` (read-only)
40
43
  * - Returns a string in the format YYYY-MM-DD based on `dateAt`.
41
- * @computed {boolean} isSpansNextDay - Flag indicating whether the date spans from start date to end date (read-only)
44
+ * @property {boolean} isSpansNextDay - Flag indicating whether the date spans from start date to end date (read-only)
42
45
  * - `true` if `startTime` is later than `endTime`
43
- * @computed {Date} startAt - Start date and time (Date object) (read-only)
46
+ * @property {Date} startAt - Start date and time (Date object) (read-only)
44
47
  * - Returns a Date object with `startTime` set based on `dateAt`.
45
48
  * - If `isStartNextDay` is true, add 1 day.
46
- * @computed {Date} endAt - End date and time (Date object) (read-only)
49
+ * @property {Date} endAt - End date and time (Date object) (read-only)
47
50
  * - Returns a Date object with `endTime` set based on `dateAt`.
48
51
  * - If `isStartNextDay` is true, add 1 day.
49
52
  * - If `isSpansNextDay` is true, add 1 day.
50
- * @computed {number} totalWorkMinutes - Total working time in minutes (excluding break time) (read-only)
53
+ * @property {number} totalWorkMinutes - Total working time in minutes (excluding break time) (read-only)
51
54
  * - Calculated as the difference between `endAt` and `startAt` minus `breakMinutes`
52
55
  * - If the difference between `endAt` and `startAt` is negative, returns 0.
53
56
  * - If `startAt` or `endAt` is not set, returns 0.
54
- * @computed {number} regularTimeWorkMinutes - Regular working time in minutes (read-only)
57
+ * @property {number} regularTimeWorkMinutes - Regular working time in minutes (read-only)
55
58
  * - The portion of `totalWorkMinutes` that is considered within the contract's `regulationWorkMinutes`.
56
59
  * - If actual working time is less than regulation time (e.g., early leave), it equals `totalWorkMinutes`.
57
60
  * - If actual working time exceeds regulation time (overtime), it equals `regulationWorkMinutes`.
58
- * @computed {number} overtimeWorkMinutes - Overtime work in minutes (read-only)
61
+ * @property {number} overtimeWorkMinutes - Overtime work in minutes (read-only)
59
62
  * - Calculated as `totalWorkMinutes` minus `regulationWorkMinutes`
60
63
  * - Overtime work is not negative; the minimum is 0.
61
64
  * ---------------------------------------------------------------------------
@@ -76,10 +79,7 @@
76
79
  * - @param {Date} v - The new `dateAt` value
77
80
  *****************************************************************************/
78
81
  import WorkingResult from "./WorkingResult.js";
79
- import {
80
- BILLING_UNIT_TYPE_VALUES,
81
- BILLING_UNIT_TYPE_OPTIONS,
82
- } from "./constants/index.js";
82
+ import { BILLING_UNIT_TYPE_VALUES } from "./constants/index.js";
83
83
  import { defField } from "./parts/fieldDefinitions.js";
84
84
 
85
85
  const classProps = {
@@ -97,15 +97,8 @@ const classProps = {
97
97
  label: "資格者時間外単価",
98
98
  required: true,
99
99
  }),
100
- billingUnitType: defField("select", {
101
- default: BILLING_UNIT_TYPE_VALUES.PER_DAY.value,
102
- label: "請求単位",
100
+ billingUnitType: defField("billingUnitType", {
103
101
  required: true,
104
- component: {
105
- attrs: {
106
- items: BILLING_UNIT_TYPE_OPTIONS,
107
- },
108
- },
109
102
  }),
110
103
  includeBreakInBilling: defField("check", {
111
104
  label: "請求に休憩時間を含める",
@@ -164,7 +157,7 @@ export default class Agreement extends WorkingResult {
164
157
  */
165
158
  get prices() {
166
159
  console.warn(
167
- "`Agreement.prices` is deprecated. Use `Agreement.billingInfo` instead."
160
+ "`Agreement.prices` is deprecated. Use `Agreement.billingInfo` instead.",
168
161
  );
169
162
  return {
170
163
  regulationWorkMinutes: this.regulationWorkMinutes,
@@ -0,0 +1,185 @@
1
+ import { BaseClass } from "@shisyamo4131/air-firebase-v2";
2
+ import { defField } from "./parts/fieldDefinitions.js";
3
+ import WorkTimeBase from "./WorkTimeBase.js";
4
+ import {
5
+ BILLING_UNIT_TYPE_VALUES,
6
+ DAY_TYPE_VALUES,
7
+ SHIFT_TYPE_VALUES,
8
+ } from "./constants/index.js";
9
+
10
+ /*****************************************************************************
11
+ * @class RateSet
12
+ *****************************************************************************/
13
+ export class RateSet extends BaseClass {
14
+ static className = "単価モデル";
15
+ static classProps = {
16
+ unitPriceBase: defField("price", {
17
+ label: "基本単価",
18
+ default: 0,
19
+ required: true,
20
+ }),
21
+ overtimeUnitPriceBase: defField("price", {
22
+ label: "残業単価",
23
+ default: 0,
24
+ required: true,
25
+ }),
26
+ unitPriceQualified: defField("price", {
27
+ label: "資格者単価",
28
+ default: 0,
29
+ required: true,
30
+ }),
31
+ overtimeUnitPriceQualified: defField("price", {
32
+ label: "資格者残業単価",
33
+ default: 0,
34
+ required: true,
35
+ }),
36
+ };
37
+ }
38
+
39
+ /*****************************************************************************
40
+ * @class DayTypeRates
41
+ *****************************************************************************/
42
+ export class DayTypeRates extends BaseClass {
43
+ static className = "曜日区分単価モデル";
44
+ static classProps = {
45
+ WEEKDAY: defField("object", {
46
+ customClass: RateSet,
47
+ default: () => new RateSet(),
48
+ required: true,
49
+ }),
50
+ SATURDAY: defField("object", {
51
+ customClass: RateSet,
52
+ default: () => new RateSet(),
53
+ required: true,
54
+ }),
55
+ SUNDAY: defField("object", {
56
+ customClass: RateSet,
57
+ default: () => new RateSet(),
58
+ required: true,
59
+ }),
60
+ HOLIDAY: defField("object", {
61
+ customClass: RateSet,
62
+ default: () => new RateSet(),
63
+ required: true,
64
+ }),
65
+ };
66
+ }
67
+
68
+ /*****************************************************************************
69
+ * @class AgreementV2
70
+ * @extends WorkTimeBase
71
+ *
72
+ * @property {Date} dateAt - 日付
73
+ * @property {string} shiftType - 勤務区分
74
+ * @property {string} startTime - 開始時刻 (HH:MM 形式)
75
+ * @property {string} endTime - 終了時刻 (HH:MM 形式)
76
+ * @property {boolean} isStartNextDay - 翌日開始フラグ
77
+ * - `true` の場合、実際の勤務は `dateAt` の翌日であることを意味します。
78
+ * @property {number} breakMinutes - 休憩時間 (分)
79
+ * @property {string} date - `dateAt` に基づく YYYY-MM-DD 形式の日付文字列 (読み取り専用)
80
+ * - `dateAt` に基づいて YYYY-MM-DD 形式の文字列を返します。
81
+ * @property {Date} startAt - 開始日時 (Date オブジェクト) (読み取り専用)
82
+ * - `dateAt` に基づいて `startTime` を設定した Date オブジェクトを返します。
83
+ * - `isStartNextDay` が true の場合、1日加算します。
84
+ * @property {Date} endAt - 終了日時 (Date オブジェクト) (読み取り専用)
85
+ * - `startAt` を起点に、最初に現れる `endTime` の Date オブジェクトを返します。
86
+ * @property {boolean} isSpansNextDay - 翌日跨ぎフラグ (読み取り専用)
87
+ * - `true` の場合、`startAt` と `endAt` の日付が異なることを意味します。
88
+ * @property {number} regulationWorkMinutes - 規定労働時間 (分)
89
+ * - `startAt` から `endAt` までの時間から `breakMinutes` を差し引いた時間のうち、
90
+ * 規定内として扱う労働時間(分)です。
91
+ * - 実際の労働時間から残業時間を算出するための基準となる値です。
92
+ * - この値があることで、取極めに柔軟な設定を行うことが可能になる他、労働基準法の 1 日の所定労働時間上限が変更された際に
93
+ * 影響を最小限に抑えることができます。
94
+ * 例) 8:00 から 17:00 までの勤務で休憩が 60 分の場合
95
+ * - 規定労働時間を 8 時間 (480 分) とし、実際の勤務が 8 時間 (480 分) を超えた分が残業時間として扱われます。
96
+ * 例) 8:00 から 16:00 までの勤務で休憩が 60 分の場合
97
+ * - 規定労働時間を 7 時間 (420 分) とすると、実際の勤務が 7 時間 (420 分) を超えた分が残業時間として扱われます。
98
+ * - 規定労働時間を 8 時間 (480 分) とすると、実際の勤務が 8 時間 (480 分) を超えた分が残業時間として扱われます。
99
+ * 例) 7:00 から 翌日 7:00 までの勤務で休憩が 60 分の場合
100
+ * - 規定労働時間を 8 時間 (480 分) とすると、実際の勤務が 8 時間 (480 分) を超えた分が残業時間として扱われます。
101
+ * この場合、最初の 8 時間までは基本単価が適用され、残りの 8 時間は残業単価が適用されるといった設定が可能になります。
102
+ * - 規定労働時間を 24 時間 (1440 分) とすると、実際の勤務が 24 時間 (1440 分) を超えた分が残業時間として扱われます。
103
+ * この場合、全ての勤務時間が基本単価で扱われるといった設定が可能になります。
104
+ * @property {DayTypeRates} rates - 曜日区分、勤務区分ごとの単価情報オブジェクト
105
+ * @property {string} billingUnitType - 請求単位 (PER_DAY, PER_HOUR)
106
+ * @property {boolean} includeBreakInBilling - 請求に休憩時間を含めるかどうかのフラグ
107
+ * @property {number} cutoffDate - 締日区分 (0: 月末, 5: 5日, 10: 10日, 15: 15日, 20: 20日, 25: 25日)
108
+ * @property {string} key - 一意なキー (読み取り専用)
109
+ * - `date` と `shiftType` を組み合わせた文字列を返します。
110
+ *
111
+ * @method setDateAtCallback - `dateAt` が設定されたときに呼び出されるコールバック関数
112
+ *
113
+ * @getter {boolean} isInvalid - クラス特有のエラーが存在するかどうかを返すプロパティ
114
+ * @getter {Array<Object>} invalidReasons - エラーコード、メッセージ、多言語メッセージ、フィールド名を含む詳細情報の配列を返すプロパティ
115
+ * @getter {boolean} isKeyChanged - `key` プロパティが変更されたかどうかを返すプロパティ
116
+ *
117
+ * @static BILLING_UNIT_TYPE - 請求単位の定数オブジェクト
118
+ * @static DAY_TYPE - 曜日区分の定数オブジェクト
119
+ * @static SHIFT_TYPE - 勤務区分の定数オブジェクト
120
+ * @static INVALID_REASON - クラス特有のエラーコードを定義する定数オブジェクト
121
+ * - `BREAK_MINUTES_NEGATIVE`: `breakMinutes` が負の値である場合のエラーコード
122
+ * - `REGULATION_WORK_MINUTES_NEGATIVE`: `regulationWorkMinutes` が負の値である場合のエラーコード
123
+ *****************************************************************************/
124
+ export default class AgreementV2 extends WorkTimeBase {
125
+ static className = "取極め";
126
+ static collectionPath = "AgreementV2s";
127
+ static useAutonumber = false;
128
+ static logicalDelete = false;
129
+ static classProps = {
130
+ ...WorkTimeBase.classProps,
131
+ rates: defField("object", {
132
+ customClass: DayTypeRates,
133
+ default: () => new DayTypeRates(),
134
+ required: true,
135
+ }),
136
+ billingUnitType: defField("billingUnitType", {
137
+ required: true,
138
+ }),
139
+ includeBreakInBilling: defField("check", {
140
+ label: "請求に休憩時間を含める",
141
+ default: false,
142
+ }),
143
+ cutoffDate: defField("cutoffDate", { required: true }),
144
+ };
145
+
146
+ /** STATIC VALUES */
147
+ static BILLING_UNIT_TYPE = BILLING_UNIT_TYPE_VALUES;
148
+ static DAY_TYPE = DAY_TYPE_VALUES;
149
+ static SHIFT_TYPE = SHIFT_TYPE_VALUES;
150
+
151
+ /**
152
+ * afterInitialize (override)
153
+ * - `key` プロパティを定義します。
154
+ * @param {Object} item - 初期化オブジェクト
155
+ */
156
+ afterInitialize(item = {}) {
157
+ super.afterInitialize(item);
158
+
159
+ Object.defineProperties(this, {
160
+ /**
161
+ * key (読み取り専用)
162
+ * - `date` と `shiftType` を組み合わせたユニークキーを返すようにします。
163
+ */
164
+ key: {
165
+ configurable: true,
166
+ enumerable: true,
167
+ get() {
168
+ return `${this.date}_${this.shiftType}`;
169
+ },
170
+ set(v) {},
171
+ },
172
+ });
173
+ }
174
+
175
+ /**
176
+ * `key` プロパティが変更されたかどうかを返します。
177
+ * - `key` は `date` と `shiftType` を組み合わせた文字列であるため、これらのいずれかが変更された場合に `true` を返します。
178
+ * @returns {boolean} `key` が変更された場合は `true`、変更されていない場合は `false` を返します。
179
+ */
180
+ get isKeyChanged() {
181
+ const current = this.key;
182
+ const before = this._beforeData?.key;
183
+ return current !== before;
184
+ }
185
+ }
@@ -3,7 +3,7 @@
3
3
  * @author shisyamo4131
4
4
  * ---------------------------------------------------------------------------
5
5
  * - Model representing arrangement notifications for employees extending SiteOperationScheduleDetail.
6
- * - The `docId` is fixed to `${siteOperationScheduleId}-${workerId}` to allow recreation of documents.
6
+ * - The `docId` is fixed to `${siteOperationScheduleId}_${workerId}` to allow recreation of documents.
7
7
  * - Status-based state management with specific transition methods.
8
8
  * - Overrides `totalWorkMinutes` to use actual work times instead of scheduled times.
9
9
  * - Direct updates are disabled; use status transition methods instead.
@@ -16,6 +16,8 @@
16
16
  * @prop {string} actualEndTime - Actual end time (HH:MM format)
17
17
  * @prop {number} actualBreakMinutes - Actual break time (minutes)
18
18
  * @prop {string} status - Arrangement notification status
19
+ * @prop {Date} notificationSentAt - Push notification sent date and time
20
+ * @prop {string} notificationError - Push notification send error message
19
21
  * ---------------------------------------------------------------------------
20
22
  * @computed {Date} actualStartAt - Actual start date and time (Date object) (read-only)
21
23
  * - Returns a Date object with `actualStartTime` set based on `dateAt`.
@@ -98,7 +100,7 @@
98
100
  * @removed {string} notificationKey - Notification key (not needed in ArrangementNotification)
99
101
  * ---------------------------------------------------------------------------
100
102
  * @method {function} create - Override to fix `docId` for recreation
101
- * - Ensures `docId` is set to `${siteOperationScheduleId}-${workerId}`.
103
+ * - Ensures `docId` is set to `${siteOperationScheduleId}_${workerId}`.
102
104
  * - Allows recreation of ArrangementNotification documents.
103
105
  * - @param {Object} updateOptions - Options for creating the document
104
106
  * @method {function} update - Disabled
@@ -159,6 +161,12 @@ const classProps = {
159
161
  default: 60,
160
162
  required: true,
161
163
  }),
164
+ notificationSentAt: defField("notificationSentAt", {
165
+ hidden: true,
166
+ }),
167
+ notificationError: defField("notificationError", {
168
+ hidden: true,
169
+ }),
162
170
  };
163
171
 
164
172
  export default class ArrangementNotification extends SiteOperationScheduleDetail {
@@ -262,7 +270,7 @@ export default class ArrangementNotification extends SiteOperationScheduleDetail
262
270
  if (!this.siteOperationScheduleId || !this.workerId) {
263
271
  throw new Error("siteOperationScheduleId and workerId are required");
264
272
  }
265
- const docId = `${this.siteOperationScheduleId}-${this.workerId}`;
273
+ const docId = `${this.siteOperationScheduleId}_${this.workerId}`;
266
274
  return await super.create({ ...updateOptions, docId });
267
275
  } catch (error) {
268
276
  throw new ContextualError(error.message, context);
@@ -430,7 +438,7 @@ export default class ArrangementNotification extends SiteOperationScheduleDetail
430
438
  if (this.type === "SERVER") {
431
439
  throw new Error(
432
440
  "fetchDocsBySiteOperationScheduleId is not supported on server side. " +
433
- "Please use this method only on client side or implement server-specific logic with explicit prefix handling."
441
+ "Please use this method only on client side or implement server-specific logic with explicit prefix handling.",
434
442
  );
435
443
  }
436
444
 
@@ -466,7 +474,7 @@ export default class ArrangementNotification extends SiteOperationScheduleDetail
466
474
  if (this.type === "SERVER") {
467
475
  throw new Error(
468
476
  "bulkDelete is not supported on server side. " +
469
- "Please use this method only on client side or implement server-specific logic with explicit prefix handling."
477
+ "Please use this method only on client side or implement server-specific logic with explicit prefix handling.",
470
478
  );
471
479
  }
472
480
 
@@ -485,18 +493,18 @@ export default class ArrangementNotification extends SiteOperationScheduleDetail
485
493
  // 関数を変数に代入せず、直接呼び出す
486
494
  const docs =
487
495
  await ArrangementNotification.fetchDocsBySiteOperationScheduleId(
488
- siteOperationScheduleId
496
+ siteOperationScheduleId,
489
497
  );
490
498
  if (docs.length === 0) return;
491
499
  await Promise.all(
492
- docs.map((doc) => doc.delete({ transaction: txn }))
500
+ docs.map((doc) => doc.delete({ transaction: txn })),
493
501
  );
494
502
  }
495
503
 
496
504
  // Delete specific notification documents if workerIds are provided.
497
505
  else {
498
506
  const docIds = workerIds.map(
499
- (id) => `${siteOperationScheduleId}-${id}`
507
+ (id) => `${siteOperationScheduleId}_${id}`,
500
508
  );
501
509
  const promises = docIds.map((id) => {
502
510
  const instance = new ArrangementNotification({ docId: id });
package/src/Billing.js CHANGED
@@ -28,6 +28,7 @@
28
28
 
29
29
  import FireModel from "@shisyamo4131/air-firebase-v2";
30
30
  import { defField } from "./parts/fieldDefinitions.js";
31
+ import { formatJstDate } from "./utils/index.js";
31
32
  import OperationResult from "./OperationResult.js";
32
33
 
33
34
  const STATUS = {
@@ -54,7 +55,7 @@ const classProps = {
54
55
  description: "",
55
56
  },
56
57
  }),
57
- remarks: defField("multipleLine"),
58
+ remarks: defField("remarks"),
58
59
  };
59
60
 
60
61
  export default class Billing extends FireModel {
@@ -74,16 +75,7 @@ export default class Billing extends FireModel {
74
75
  configurable: true,
75
76
  enumerable: true,
76
77
  get() {
77
- if (!this.billingDateAt) return null;
78
- const jstDate = new Date(
79
- this.billingDateAt.getTime() + 9 * 60 * 60 * 1000
80
- ); /* JST補正 */
81
- const year = jstDate.getUTCFullYear();
82
- const month = jstDate.getUTCMonth() + 1;
83
- const day = jstDate.getUTCDate();
84
- return `${year}-${String(month).padStart(2, "0")}-${String(
85
- day
86
- ).padStart(2, "0")}`;
78
+ return formatJstDate(this.billingDateAt);
87
79
  },
88
80
  set(v) {},
89
81
  },
@@ -91,13 +83,7 @@ export default class Billing extends FireModel {
91
83
  configurable: true,
92
84
  enumerable: true,
93
85
  get() {
94
- if (!this.billingDateAt) return null;
95
- const jstDate = new Date(
96
- this.billingDateAt.getTime() + 9 * 60 * 60 * 1000
97
- ); /* JST補正 */
98
- const year = jstDate.getUTCFullYear();
99
- const month = jstDate.getUTCMonth() + 1;
100
- return `${year}-${String(month).padStart(2, "0")}`;
86
+ return formatJstDate(this.billingDateAt, "YYYY-MM");
101
87
  },
102
88
  set(v) {},
103
89
  },
@@ -108,16 +94,7 @@ export default class Billing extends FireModel {
108
94
  configurable: true,
109
95
  enumerable: true,
110
96
  get() {
111
- if (!this.paymentDueDateAt) return null;
112
- const jstDate = new Date(
113
- this.paymentDueDateAt.getTime() + 9 * 60 * 60 * 1000
114
- ); /* JST補正 */
115
- const year = jstDate.getUTCFullYear();
116
- const month = jstDate.getUTCMonth() + 1;
117
- const day = jstDate.getUTCDate();
118
- return `${year}-${String(month).padStart(2, "0")}-${String(
119
- day
120
- ).padStart(2, "0")}`;
97
+ return formatJstDate(this.paymentDueDateAt);
121
98
  },
122
99
  set(v) {},
123
100
  },
@@ -125,13 +102,7 @@ export default class Billing extends FireModel {
125
102
  configurable: true,
126
103
  enumerable: true,
127
104
  get() {
128
- if (!this.paymentDueDateAt) return null;
129
- const jstDate = new Date(
130
- this.paymentDueDateAt.getTime() + 9 * 60 * 60 * 1000
131
- ); /* JST補正 */
132
- const year = jstDate.getUTCFullYear();
133
- const month = jstDate.getUTCMonth() + 1;
134
- return `${year}-${String(month).padStart(2, "0")}`;
105
+ return formatJstDate(this.paymentDueDateAt, "YYYY-MM");
135
106
  },
136
107
  set(v) {},
137
108
  },