@shisyamo4131/air-guard-v2-schemas 2.3.7-dev.7 → 2.3.7

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/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  export { default as Agreement } from "./src/Agreement.js";
2
2
  export { default as ArrangementNotification } from "./src/ArrangementNotification.js";
3
3
  export { default as Billing } from "./src/Billing.js";
4
+ export { default as Certification } from "./src/Certification.js";
4
5
  export { default as Company } from "./src/Company.js";
5
6
  export { default as Customer, CustomerMinimal } from "./src/Customer.js";
6
7
  export { default as CutoffDate } from "./src/utils/CutoffDate.js";
@@ -14,4 +15,5 @@ export { default as Site } from "./src/Site.js";
14
15
  export { default as SiteOperationSchedule } from "./src/SiteOperationSchedule.js";
15
16
  export { default as SiteOperationScheduleDetail } from "./src/SiteOperationScheduleDetail.js";
16
17
  export { default as SiteOrder } from "./src/SiteOrder.js";
18
+ export { default as System } from "./src/System.js";
17
19
  export { default as User } from "./src/User.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shisyamo4131/air-guard-v2-schemas",
3
- "version": "2.3.7-dev.7",
3
+ "version": "2.3.7",
4
4
  "description": "Schemas for AirGuard V2",
5
5
  "type": "module",
6
6
  "main": "index.js",
package/src/Agreement.js CHANGED
@@ -76,11 +76,10 @@
76
76
  *****************************************************************************/
77
77
  import WorkingResult from "./WorkingResult.js";
78
78
  import {
79
- VALUES as BILLING_UNIT_TYPE,
80
- OPTIONS as BILLING_UNIT_TYPE_OPTIONS,
81
- } from "./constants/billing-unit-type.js";
79
+ BILLING_UNIT_TYPE_VALUES,
80
+ BILLING_UNIT_TYPE_OPTIONS,
81
+ } from "./constants/index.js";
82
82
  import { defField } from "./parts/fieldDefinitions.js";
83
- import CutoffDate from "./utils/CutoffDate.js";
84
83
 
85
84
  const classProps = {
86
85
  ...WorkingResult.classProps,
@@ -98,7 +97,7 @@ const classProps = {
98
97
  required: true,
99
98
  }),
100
99
  billingUnitType: defField("select", {
101
- default: BILLING_UNIT_TYPE.PER_DAY.value,
100
+ default: BILLING_UNIT_TYPE_VALUES.PER_DAY.value,
102
101
  label: "請求単位",
103
102
  required: true,
104
103
  component: {
@@ -111,23 +110,14 @@ const classProps = {
111
110
  label: "請求に休憩時間を含める",
112
111
  default: false,
113
112
  }),
114
- cutoffDate: defField("select", {
115
- label: "締日区分",
116
- default: CutoffDate.VALUES.END_OF_MONTH,
117
- required: true,
118
- component: {
119
- attrs: {
120
- items: CutoffDate.OPTIONS,
121
- },
122
- },
123
- }),
113
+ cutoffDate: defField("cutoffDate", { required: true }),
124
114
  };
125
115
 
126
116
  export default class Agreement extends WorkingResult {
127
117
  static className = "取極め";
128
118
  static classProps = classProps;
129
119
 
130
- static BILLING_UNIT_TYPE = BILLING_UNIT_TYPE;
120
+ static BILLING_UNIT_TYPE = BILLING_UNIT_TYPE_VALUES;
131
121
 
132
122
  /**
133
123
  * Returns an object containing price-related properties.
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Certification Model
3
+ * @version 1.0.0
4
+ * @author shisyamo4131
5
+ * @description 警備業務資格モデル
6
+ *
7
+ * NOTE: 配列で管理されるので key が必要。2025-12-08 現在、資格名が重複することはない想定。
8
+ * 但し、2バイト文字が key として適切かは要検討。
9
+ */
10
+ import { BaseClass } from "@shisyamo4131/air-firebase-v2";
11
+ import { defField } from "./parts/fieldDefinitions.js";
12
+
13
+ const classProps = {
14
+ name: defField("name", { label: "資格名", required: true }),
15
+ type: defField("certificationType", { required: true }),
16
+ issuedBy: defField("name", { label: "発行元" }),
17
+ issueDateAt: defField("dateAt", { label: "取得日", required: true }),
18
+ expirationDateAt: defField("dateAt", { label: "有効期限" }),
19
+ serialNumber: defField("oneLine", { label: "証明書番号" }),
20
+ };
21
+
22
+ /**
23
+ * @prop {string} name - 資格名
24
+ * @prop {string} type - 資格種別 (CERTIFICATION_TYPE_VALUES)
25
+ * @prop {string} issuedBy - 発行元
26
+ * @prop {Date} issueDateAt - 取得日
27
+ * @prop {Date} expirationDateAt - 有効期限
28
+ * @prop {string} serialNumber - 証明書番号
29
+ *
30
+ * @prop {string} key - 資格名 (nameと同じ) (読み取り専用)
31
+ */
32
+ export default class Certification extends BaseClass {
33
+ static className = "資格";
34
+ static classProps = classProps;
35
+
36
+ afterInitialize(item = {}) {
37
+ super.afterInitialize(item);
38
+ Object.defineProperties(this, {
39
+ key: {
40
+ configurable: true,
41
+ enumerable: true,
42
+ get() {
43
+ return this.name;
44
+ },
45
+ set() {},
46
+ },
47
+ });
48
+ }
49
+ }
package/src/Company.js CHANGED
@@ -1,7 +1,9 @@
1
1
  /**
2
2
  * Company Model
3
- * @version 1.2.0
3
+ * @version 1.4.0
4
4
  * @author shisyamo4131
5
+ * @update 2025-12-02 Add maintenance information properties.
6
+ * @update 2025-12-01 Add Stripe integration fields (stripeCustomerId, subscription).
5
7
  * @update 2025-11-27 Add bank information fields for billing.
6
8
  * @update 2025-11-23 Set `usePrefix` to false.
7
9
  */
@@ -92,6 +94,30 @@ const classProps = {
92
94
  },
93
95
  },
94
96
  }),
97
+
98
+ /** Stripe連携フィールド */
99
+ stripeCustomerId: defField("oneLine", {
100
+ label: "Stripe顧客ID",
101
+ hidden: true,
102
+ length: 100,
103
+ }),
104
+
105
+ subscription: defField("object", {
106
+ label: "サブスクリプション情報",
107
+ hidden: true,
108
+ default: () => ({
109
+ id: null,
110
+ status: null,
111
+ currentPeriodEnd: null,
112
+ employeeLimit: 10,
113
+ }),
114
+ }),
115
+
116
+ /** メンテナンス情報 */
117
+ maintenanceMode: defField("check", { default: false, hidden: true }),
118
+ maintenanceReason: defField("oneLine", { default: null, hidden: true }),
119
+ maintenanceStartAt: defField("dateAt", { default: null, hidden: true }),
120
+ maintenanceStartedBy: defField("oneLine", { default: null, hidden: true }),
95
121
  };
96
122
 
97
123
  export default class Company extends FireModel {
package/src/Customer.js CHANGED
@@ -1,44 +1,19 @@
1
- /*****************************************************************************
2
- * Customer ver 1.1.0
3
- * @author shisyamo4131
4
- *
5
- * @description Customer model.
6
- *
1
+ /**
2
+ * Customer
3
+ * @version 1.1.1
4
+ * @description This module defines the Customer model for managing customer data.
7
5
  * @hasMany Sites - related sites associated with the customer
8
- *
9
- * @prop {string} code - customer code
10
- * @prop {string} name - customer name
11
- * @prop {string} nameKana - customer name in kana
12
- * @prop {string} zipcode - postal code
13
- * @prop {string} prefCode - prefecture code
14
- * @prop {string} city - city name
15
- * @prop {string} address - address details
16
- * @prop {string} building - building name
17
- * @prop {object} location - geographical location
18
- * @prop {string} tel - telephone number
19
- * @prop {string} fax - fax number
20
- * @prop {string} contractStatus - contract status
21
- * @prop {number} paymentMonth - payment site in months
22
- * @prop {string} paymentDate - payment site date
23
- * @prop {string} remarks - additional remarks
24
- *
25
- * @readonly
26
- * @prop {string} fullAddress - full address combining prefecture, city, and address (read-only)
27
- * @prop {string} prefecture - prefecture name derived from `prefCode` (read-only)
28
- *
29
- * @static
30
- * @prop {string} STATUS_ACTIVE - constant for active contract status
31
- * @prop {string} STATUS_TERMINATED - constant for terminated contract status
32
- *
33
- * @method getPaymentDueDateAt
34
- * @param {Date} baseDate - base date in UTC (JST - 9 hours)
35
- * @returns {Date} payment due date in UTC (JST - 9 hours)
36
- *****************************************************************************/
6
+ * @author shisyamo4131
7
+ * @update 2025-12-08 - Changed `paymentMonth` type from direct number to select field.
8
+ */
37
9
  import FireModel from "@shisyamo4131/air-firebase-v2";
38
10
  import { defField } from "./parts/fieldDefinitions.js";
39
11
  import { defAccessor } from "./parts/accessorDefinitions.js";
40
- import { VALUES } from "./constants/contract-status.js";
41
12
  import CutoffDate from "./utils/CutoffDate.js";
13
+ import {
14
+ CONTRACT_STATUS_VALUES,
15
+ PAYMENT_MONTH_OPTIONS,
16
+ } from "./constants/index.js";
42
17
 
43
18
  const classProps = {
44
19
  code: defField("code", { label: "取引先コード" }),
@@ -53,14 +28,20 @@ const classProps = {
53
28
  tel: defField("tel", { colsDefinition: { cols: 12, sm: 6 } }),
54
29
  fax: defField("fax", { colsDefinition: { cols: 12, sm: 6 } }),
55
30
  contractStatus: defField("contractStatus", { required: true }),
56
- paymentMonth: defField("number", {
31
+ cutoffDate: defField("cutoffDate", { required: true }),
32
+ paymentMonth: defField("select", {
57
33
  default: 1,
58
34
  label: "入金サイト(月数)",
59
35
  required: true,
36
+ component: {
37
+ attrs: {
38
+ items: PAYMENT_MONTH_OPTIONS,
39
+ },
40
+ },
60
41
  }),
61
42
  paymentDate: defField("select", {
62
43
  label: "入金サイト(日付)",
63
- default: CutoffDate.VALUES.END_OF_MONTH,
44
+ default: CutoffDate.VALUES[0].value,
64
45
  required: true,
65
46
  component: {
66
47
  attrs: {
@@ -71,6 +52,36 @@ const classProps = {
71
52
  remarks: defField("multipleLine", { label: "備考" }),
72
53
  };
73
54
 
55
+ /*****************************************************************************
56
+ * @prop {string} code - customer code
57
+ * @prop {string} name - customer name
58
+ * @prop {string} nameKana - customer name in kana
59
+ * @prop {string} zipcode - postal code
60
+ * @prop {string} prefCode - prefecture code
61
+ * @prop {string} city - city name
62
+ * @prop {string} address - address details
63
+ * @prop {string} building - building name
64
+ * @prop {object} location - geographical location
65
+ * @prop {string} tel - telephone number
66
+ * @prop {string} fax - fax number
67
+ * @prop {string} contractStatus - contract status
68
+ * @prop {number} paymentMonth - payment site in months
69
+ * @prop {string} paymentDate - payment site date
70
+ * @prop {string} remarks - additional remarks
71
+ *
72
+ * @readonly
73
+ * @prop {string} fullAddress - full address combining prefecture, city, and address (read-only)
74
+ * @prop {string} prefecture - prefecture name derived from `prefCode` (read-only)
75
+ *
76
+ * @static
77
+ * @prop {object} STATUS - constant mapping for contract statuses
78
+ * @prop {string} STATUS_ACTIVE - constant for active contract status
79
+ * @prop {string} STATUS_TERMINATED - constant for terminated contract status
80
+ *
81
+ * @method getPaymentDueDateAt
82
+ * @param {Date} baseDate - base date in UTC (JST - 9 hours)
83
+ * @returns {Date} payment due date in UTC (JST - 9 hours)
84
+ *****************************************************************************/
74
85
  export default class Customer extends FireModel {
75
86
  static className = "取引先";
76
87
  static collectionPath = "Customers";
@@ -93,8 +104,9 @@ export default class Customer extends FireModel {
93
104
  { key: "fullAddress", title: "所在地" },
94
105
  ];
95
106
 
96
- static STATUS_ACTIVE = VALUES.ACTIVE.value;
97
- static STATUS_TERMINATED = VALUES.TERMINATED.value;
107
+ static STATUS = CONTRACT_STATUS_VALUES;
108
+ static STATUS_ACTIVE = CONTRACT_STATUS_VALUES.ACTIVE.value;
109
+ static STATUS_TERMINATED = CONTRACT_STATUS_VALUES.TERMINATED.value;
98
110
 
99
111
  afterInitialize(item = {}) {
100
112
  super.afterInitialize(item);
@@ -123,7 +135,7 @@ export default class Customer extends FireModel {
123
135
  const finalMonth = targetMonth % 12;
124
136
 
125
137
  let dueDate;
126
- if (this.paymentDate === CutoffDate.VALUES.END_OF_MONTH) {
138
+ if (this.paymentDate === CutoffDate.VALUES[0].value) {
127
139
  // 月末の場合
128
140
  dueDate = new Date(Date.UTC(targetYear, finalMonth + 1, 0));
129
141
  } else {