@shisyamo4131/air-guard-v2-schemas 2.3.7-dev.3 → 2.3.7-dev.31
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 +1 -0
- package/package.json +1 -1
- package/src/Company.js +27 -1
- package/src/Customer.js +50 -36
- package/src/Employee.js +368 -58
- package/src/OperationBilling.js +28 -14
- package/src/OperationResult.js +36 -16
- package/src/Site.js +42 -15
- package/src/SiteOperationSchedule.js +27 -20
- package/src/System.js +43 -0
- package/src/apis/index.js +4 -0
- package/src/constants/blood-type.js +14 -0
- package/src/constants/emergency-contact-relation.js +16 -0
- package/src/constants/index.js +8 -0
- package/src/parts/accessorDefinitions.js +13 -27
- package/src/parts/fieldDefinitions.js +118 -1
package/src/OperationResult.js
CHANGED
|
@@ -541,39 +541,56 @@ export default class OperationResult extends Operation {
|
|
|
541
541
|
}
|
|
542
542
|
|
|
543
543
|
/**
|
|
544
|
-
* Synchronize customerId from siteId
|
|
544
|
+
* Synchronize customerId and apply (re-apply) agreement from siteId
|
|
545
|
+
* @param {Object} [args.transaction] - Firestore transaction.
|
|
546
|
+
* @param {Function} [args.callBack] - Callback function.
|
|
547
|
+
* @param {string} [args.prefix] - Path prefix.
|
|
545
548
|
* @returns {Promise<void>}
|
|
546
549
|
* @throws {Error} If the specified siteId does not exist
|
|
547
550
|
*/
|
|
548
|
-
async
|
|
551
|
+
async _syncCustomerIdAndApplyAgreement(args = {}) {
|
|
549
552
|
if (!this.siteId) return;
|
|
550
553
|
const siteInstance = new Site();
|
|
551
|
-
const siteExists = await siteInstance.fetch({
|
|
554
|
+
const siteExists = await siteInstance.fetch({
|
|
555
|
+
...args,
|
|
556
|
+
docId: this.siteId,
|
|
557
|
+
});
|
|
552
558
|
if (!siteExists) {
|
|
553
559
|
throw new Error(
|
|
554
560
|
`[OperationResult] The specified siteId (${this.siteId}) does not exist.`
|
|
555
561
|
);
|
|
556
562
|
}
|
|
557
563
|
this.customerId = siteInstance.customerId;
|
|
564
|
+
this.agreement = siteInstance.getAgreement(this);
|
|
558
565
|
}
|
|
559
566
|
|
|
560
567
|
/**
|
|
561
568
|
* Override beforeCreate to sync customerId
|
|
569
|
+
* @param {Object} args - Creation options.
|
|
570
|
+
* @param {string} [args.docId] - Document ID to use (optional).
|
|
571
|
+
* @param {boolean} [args.useAutonumber=true] - Whether to use auto-numbering.
|
|
572
|
+
* @param {Object} [args.transaction] - Firestore transaction.
|
|
573
|
+
* @param {Function} [args.callBack] - Callback function.
|
|
574
|
+
* @param {string} [args.prefix] - Path prefix.
|
|
562
575
|
* @returns {Promise<void>}
|
|
563
576
|
*/
|
|
564
|
-
async beforeCreate() {
|
|
565
|
-
await super.beforeCreate();
|
|
577
|
+
async beforeCreate(args = {}) {
|
|
578
|
+
await super.beforeCreate(args);
|
|
566
579
|
|
|
567
|
-
// Sync customerId
|
|
568
|
-
await this.
|
|
580
|
+
// Sync customerId and apply agreement
|
|
581
|
+
await this._syncCustomerIdAndApplyAgreement();
|
|
569
582
|
}
|
|
570
583
|
|
|
571
584
|
/**
|
|
572
|
-
* Override beforeUpdate to sync customerId if
|
|
585
|
+
* Override beforeUpdate to sync customerId and apply agreement if key changed
|
|
586
|
+
* @param {Object} args - Creation options.
|
|
587
|
+
* @param {Object} [args.transaction] - Firestore transaction.
|
|
588
|
+
* @param {Function} [args.callBack] - Callback function.
|
|
589
|
+
* @param {string} [args.prefix] - Path prefix.
|
|
573
590
|
* @returns {Promise<void>}
|
|
574
591
|
*/
|
|
575
|
-
async beforeUpdate() {
|
|
576
|
-
await super.beforeUpdate();
|
|
592
|
+
async beforeUpdate(args = {}) {
|
|
593
|
+
await super.beforeUpdate(args);
|
|
577
594
|
|
|
578
595
|
// Prevent editing if isLocked is true
|
|
579
596
|
if (this.isLocked) {
|
|
@@ -582,19 +599,22 @@ export default class OperationResult extends Operation {
|
|
|
582
599
|
);
|
|
583
600
|
}
|
|
584
601
|
|
|
585
|
-
// Sync customerId if
|
|
586
|
-
if (this.
|
|
587
|
-
await this.
|
|
602
|
+
// Sync customerId and apply agreement if key changed
|
|
603
|
+
if (this.key === this._beforeData.key) return;
|
|
604
|
+
await this._syncCustomerIdAndApplyAgreement();
|
|
588
605
|
}
|
|
589
606
|
|
|
590
607
|
/**
|
|
591
608
|
* Override beforeDelete to prevent deletion if isLocked is true
|
|
609
|
+
* @param {Object} args - Creation options.
|
|
610
|
+
* @param {Object} [args.transaction] - Firestore transaction.
|
|
611
|
+
* @param {Function} [args.callBack] - Callback function.
|
|
612
|
+
* @param {string} [args.prefix] - Path prefix.
|
|
592
613
|
* @returns {Promise<void>}
|
|
593
614
|
* @throws {Error} If isLocked is true
|
|
594
615
|
*/
|
|
595
|
-
async beforeDelete() {
|
|
596
|
-
await super.beforeDelete();
|
|
597
|
-
|
|
616
|
+
async beforeDelete(args = {}) {
|
|
617
|
+
await super.beforeDelete(args);
|
|
598
618
|
// Prevent deletion if isLocked is true
|
|
599
619
|
if (this.isLocked) {
|
|
600
620
|
throw new Error(
|
package/src/Site.js
CHANGED
|
@@ -5,26 +5,23 @@
|
|
|
5
5
|
* @update 2025-11-20 version 0.2.0-bata
|
|
6
6
|
* - Prevent changing customer reference on update.
|
|
7
7
|
* - Move `customer` property to the top of classProps for better visibility.
|
|
8
|
+
*
|
|
9
|
+
* NOTE: `customer` プロパティについて
|
|
10
|
+
* 自身の従属先データを持たせる場合に `XxxxxMinimal` クラスを使用するが、アプリ側でオブジェクト選択を行う場合に
|
|
11
|
+
* `Xxxxx` クラスにするのか `XxxxxMinimal` クラスにするのかを判断できないため、docId を持たせて
|
|
12
|
+
* `beforeCreate` フックでオブジェクトを取得するようにする。
|
|
13
|
+
* 尚、取引先は変更できない仕様。
|
|
8
14
|
*/
|
|
9
15
|
import { default as FireModel } from "@shisyamo4131/air-firebase-v2";
|
|
10
16
|
import { defField } from "./parts/fieldDefinitions.js";
|
|
11
17
|
import { defAccessor } from "./parts/accessorDefinitions.js";
|
|
12
|
-
import
|
|
13
|
-
import { fetchDocsApi } from "./apis/index.js";
|
|
18
|
+
import Customer from "./Customer.js";
|
|
14
19
|
import Agreement from "./Agreement.js";
|
|
15
20
|
import { VALUES } from "./constants/site-status.js";
|
|
16
21
|
|
|
17
22
|
const classProps = {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
customClass: CustomerMinimal,
|
|
21
|
-
component: {
|
|
22
|
-
attrs: {
|
|
23
|
-
api: () => fetchDocsApi(CustomerMinimal),
|
|
24
|
-
noFilter: true,
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
}),
|
|
23
|
+
customerId: defField("customerId", { required: true }),
|
|
24
|
+
customer: defField("customer", { hidden: true, customClass: Customer }),
|
|
28
25
|
code: defField("code", { label: "現場コード" }),
|
|
29
26
|
name: defField("name", {
|
|
30
27
|
label: "現場名",
|
|
@@ -118,12 +115,42 @@ export default class Site extends FireModel {
|
|
|
118
115
|
static STATUS_ACTIVE = VALUES.ACTIVE.value;
|
|
119
116
|
static STATUS_TERMINATED = VALUES.TERMINATED.value;
|
|
120
117
|
|
|
118
|
+
/**
|
|
119
|
+
* Overrides to fetch and set the customer object before creation.
|
|
120
|
+
* @param {Object} args - Creation options.
|
|
121
|
+
* @param {string} [args.docId] - Document ID to use (optional).
|
|
122
|
+
* @param {boolean} [args.useAutonumber=true] - Whether to use auto-numbering.
|
|
123
|
+
* @param {Object} [args.transaction] - Firestore transaction.
|
|
124
|
+
* @param {Function} [args.callBack] - Callback function.
|
|
125
|
+
* @param {string} [args.prefix] - Path prefix.
|
|
126
|
+
* @returns {Promise<void>}
|
|
127
|
+
*/
|
|
128
|
+
async beforeCreate(args = {}) {
|
|
129
|
+
await super.beforeCreate(args);
|
|
130
|
+
if (!this.customerId) return;
|
|
131
|
+
const customerInstance = new Customer();
|
|
132
|
+
const isExist = await customerInstance.fetch({
|
|
133
|
+
...args,
|
|
134
|
+
docId: this.customerId,
|
|
135
|
+
});
|
|
136
|
+
if (!isExist) {
|
|
137
|
+
return Promise.reject(
|
|
138
|
+
new Error("Invalid customerId: Customer does not exist.")
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
this.customer = customerInstance;
|
|
142
|
+
}
|
|
143
|
+
|
|
121
144
|
/**
|
|
122
145
|
* Override beforeUpdate to prevent changing customer reference.
|
|
146
|
+
* @param {Object} args - Creation options.
|
|
147
|
+
* @param {Object} [args.transaction] - Firestore transaction.
|
|
148
|
+
* @param {Function} [args.callBack] - Callback function.
|
|
149
|
+
* @param {string} [args.prefix] - Path prefix.
|
|
123
150
|
* @returns {Promise<void>}
|
|
124
151
|
*/
|
|
125
|
-
async beforeUpdate() {
|
|
126
|
-
await super.beforeUpdate();
|
|
152
|
+
async beforeUpdate(args = {}) {
|
|
153
|
+
await super.beforeUpdate(args);
|
|
127
154
|
if (this.customer.docId !== this._beforeData.customer.docId) {
|
|
128
155
|
return Promise.reject(
|
|
129
156
|
new Error("Not allowed to change customer reference.")
|
|
@@ -135,7 +162,7 @@ export default class Site extends FireModel {
|
|
|
135
162
|
super.afterInitialize(item);
|
|
136
163
|
|
|
137
164
|
Object.defineProperties(this, {
|
|
138
|
-
customerId: defAccessor("customerId"),
|
|
165
|
+
// customerId: defAccessor("customerId"),
|
|
139
166
|
fullAddress: defAccessor("fullAddress"),
|
|
140
167
|
prefecture: defAccessor("prefecture"),
|
|
141
168
|
});
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/*****************************************************************************
|
|
2
2
|
* SiteOperationSchedule Model ver 1.1.0
|
|
3
|
-
* @version 1.1.
|
|
3
|
+
* @version 1.1.1
|
|
4
4
|
* @author shisyamo4131
|
|
5
5
|
*
|
|
6
|
+
* @update 2025-11-28 v1.1.1 - Removed the `agreement` parameter from `syncToOperationResult` method.
|
|
6
7
|
* @update 2025-11-22 v1.1.0 - Moved `duplicate`, `notify`, `syncToOperationResult`,
|
|
7
8
|
* and `toEvent` methods from client side code.
|
|
8
9
|
*
|
|
@@ -167,7 +168,8 @@
|
|
|
167
168
|
* @method syncToOperationResult - Creates an OperationResult document based on the current SiteOperationSchedule
|
|
168
169
|
* - The OperationResult document ID will be the same as the SiteOperationSchedule document ID.
|
|
169
170
|
* - Sets the `operationResultId` property of the SiteOperationSchedule to the created OperationResult document ID.
|
|
170
|
-
* -
|
|
171
|
+
* - If an OperationResult already exists, it will be overwritten.
|
|
172
|
+
* - [UPDATE 2025-11-28] Removed the `agreement` parameter. The agreement is now fetched internally.
|
|
171
173
|
*
|
|
172
174
|
* @method toEvent - Converts the SiteOperationSchedule instance to a VCalendar event object
|
|
173
175
|
* - Returns an object with properties required for displaying events in Vuetify's VCalendar component.
|
|
@@ -383,27 +385,35 @@ export default class SiteOperationSchedule extends Operation {
|
|
|
383
385
|
/**
|
|
384
386
|
* Override `beforeUpdate`.
|
|
385
387
|
* - Prevents updates if an associated OperationResult exists.
|
|
388
|
+
* @param {Object} args - Creation options.
|
|
389
|
+
* @param {Object} [args.transaction] - Firestore transaction.
|
|
390
|
+
* @param {Function} [args.callBack] - Callback function.
|
|
391
|
+
* @param {string} [args.prefix] - Path prefix.
|
|
386
392
|
*/
|
|
387
|
-
async beforeUpdate() {
|
|
393
|
+
async beforeUpdate(args = {}) {
|
|
388
394
|
if (this._beforeData.operationResultId) {
|
|
389
395
|
throw new Error(
|
|
390
396
|
`Could not update this document. The OperationResult based on this document already exists. OperationResultId: ${this._beforeData.operationResultId}`
|
|
391
397
|
);
|
|
392
398
|
}
|
|
393
|
-
await super.beforeUpdate();
|
|
399
|
+
await super.beforeUpdate(args);
|
|
394
400
|
}
|
|
395
401
|
|
|
396
402
|
/**
|
|
397
403
|
* Override `beforeDelete`.
|
|
398
404
|
* - Prevents deletions if an associated OperationResult exists.
|
|
405
|
+
* @param {Object} args - Creation options.
|
|
406
|
+
* @param {Object} [args.transaction] - Firestore transaction.
|
|
407
|
+
* @param {Function} [args.callBack] - Callback function.
|
|
408
|
+
* @param {string} [args.prefix] - Path prefix.
|
|
399
409
|
*/
|
|
400
|
-
async beforeDelete() {
|
|
410
|
+
async beforeDelete(args = {}) {
|
|
401
411
|
if (this._beforeData.operationResultId) {
|
|
402
412
|
throw new Error(
|
|
403
413
|
`Could not delete this document. The OperationResult based on this document already exists. OperationResultId: ${this._beforeData.operationResultId}`
|
|
404
414
|
);
|
|
405
415
|
}
|
|
406
|
-
await super.beforeDelete();
|
|
416
|
+
await super.beforeDelete(args);
|
|
407
417
|
}
|
|
408
418
|
|
|
409
419
|
/**
|
|
@@ -679,9 +689,14 @@ export default class SiteOperationSchedule extends Operation {
|
|
|
679
689
|
* 既に存在する場合は上書きされます。
|
|
680
690
|
* - 現場稼働予定ドキュメントの `operationResultId` プロパティに
|
|
681
691
|
* 作成された稼働実績ドキュメントの ID が設定されます。(当該ドキュメント ID と同一)
|
|
682
|
-
* @param {Object}
|
|
692
|
+
* @param {Object} notifications - 配置通知オブジェクトのマップ。
|
|
693
|
+
* - キー: 配置通知の一意キー(`notificationKey` プロパティ)
|
|
694
|
+
* - 値: 配置通知ドキュメントオブジェクト
|
|
695
|
+
* @returns {Promise<void>}
|
|
696
|
+
*
|
|
697
|
+
* @update 2025-11-28 - Removed the `agreement` parameter.
|
|
683
698
|
*/
|
|
684
|
-
async syncToOperationResult(
|
|
699
|
+
async syncToOperationResult(notifications = {}) {
|
|
685
700
|
if (!this.docId) {
|
|
686
701
|
throw new Error(
|
|
687
702
|
"不正な処理です。作成前の現場稼働予定から稼働実績を作成することはできません。"
|
|
@@ -695,18 +710,12 @@ export default class SiteOperationSchedule extends Operation {
|
|
|
695
710
|
return this[prop].map((w) => {
|
|
696
711
|
const notification = notifications[w.notificationKey];
|
|
697
712
|
if (!notification) return w;
|
|
698
|
-
const {
|
|
699
|
-
actualStartTime: startTime,
|
|
700
|
-
actualEndTime: endTime,
|
|
701
|
-
actualBreakMinutes: breakMinutes,
|
|
702
|
-
actualIsStartNextDay: isStartNextDay,
|
|
703
|
-
} = notification;
|
|
704
713
|
return new SiteOperationScheduleDetail({
|
|
705
714
|
...w.toObject(),
|
|
706
|
-
startTime,
|
|
707
|
-
endTime,
|
|
708
|
-
breakMinutes,
|
|
709
|
-
isStartNextDay,
|
|
715
|
+
startTime: notification.actualStartTime,
|
|
716
|
+
endTime: notification.actualEndTime,
|
|
717
|
+
breakMinutes: notification.actualBreakMinutes,
|
|
718
|
+
isStartNextDay: notification.actualIsStartNextDay,
|
|
710
719
|
});
|
|
711
720
|
});
|
|
712
721
|
};
|
|
@@ -718,10 +727,8 @@ export default class SiteOperationSchedule extends Operation {
|
|
|
718
727
|
...this.toObject(),
|
|
719
728
|
employees,
|
|
720
729
|
outsourcers,
|
|
721
|
-
agreement: agreement || null,
|
|
722
730
|
siteOperationScheduleId: this.docId,
|
|
723
731
|
});
|
|
724
|
-
operationResult.refreshBillingDateAt();
|
|
725
732
|
await this.constructor.runTransaction(async (transaction) => {
|
|
726
733
|
const docRef = await operationResult.create({
|
|
727
734
|
docId: this.docId,
|
package/src/System.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* System.js
|
|
3
|
+
* @version 1.0.0
|
|
4
|
+
* @description System model
|
|
5
|
+
* @author shisyamo4131
|
|
6
|
+
*/
|
|
7
|
+
import FireModel from "@shisyamo4131/air-firebase-v2";
|
|
8
|
+
import { defField } from "./parts/fieldDefinitions.js";
|
|
9
|
+
|
|
10
|
+
const classProps = {
|
|
11
|
+
isMaintenance: defField("check", { default: false, hidden: true }),
|
|
12
|
+
updatedAt: defField("dateAt", { default: null, hidden: true }),
|
|
13
|
+
lastMaintenanceBy: defField("oneLine", {
|
|
14
|
+
default: "admin-sdk",
|
|
15
|
+
hidden: true,
|
|
16
|
+
}),
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @prop {boolean} isMaintenance - maintenance mode flag
|
|
21
|
+
* @prop {Date} updatedAt - last updated timestamp
|
|
22
|
+
* @prop {string} lastMaintenanceBy - identifier of the last maintainer
|
|
23
|
+
*/
|
|
24
|
+
export default class System extends FireModel {
|
|
25
|
+
static className = "System";
|
|
26
|
+
static collectionPath = "System";
|
|
27
|
+
static usePrefix = false;
|
|
28
|
+
static useAutonumber = false;
|
|
29
|
+
static logicalDelete = false;
|
|
30
|
+
static classProps = classProps;
|
|
31
|
+
|
|
32
|
+
async create() {
|
|
33
|
+
return Promise.reject(new Error("[System.js] Not implemented."));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async update() {
|
|
37
|
+
return Promise.reject(new Error("[System.js] Not implemented."));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async delete() {
|
|
41
|
+
return Promise.reject(new Error("[System.js] Not implemented."));
|
|
42
|
+
}
|
|
43
|
+
}
|
package/src/apis/index.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
// 2025-12-08
|
|
2
|
+
// アプリ側で `useFetchXxxx` コンポーザブルを使用した API 連携を行う為
|
|
3
|
+
// このファイルは不要。
|
|
4
|
+
// 各種関数に依存しているファイルの存在がないことを確認の上、削除予定。
|
|
1
5
|
export function fetchDocsApi(constructor) {
|
|
2
6
|
const instance = new constructor();
|
|
3
7
|
return async (search) => await instance.fetchDocs({ constraints: search });
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// prettier-ignore
|
|
2
|
+
export const VALUES = Object.freeze({
|
|
3
|
+
A: { title: "A型", value: "A" },
|
|
4
|
+
B: { title: "B型", value: "B" },
|
|
5
|
+
O: { title: "O型", value: "O" },
|
|
6
|
+
AB: { title: "AB型", value: "AB" },
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export const OPTIONS = [
|
|
10
|
+
{ title: VALUES.A.title, value: VALUES.A.value },
|
|
11
|
+
{ title: VALUES.B.title, value: VALUES.B.value },
|
|
12
|
+
{ title: VALUES.O.title, value: VALUES.O.value },
|
|
13
|
+
{ title: VALUES.AB.title, value: VALUES.AB.value },
|
|
14
|
+
];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// prettier-ignore
|
|
2
|
+
export const VALUES = Object.freeze({
|
|
3
|
+
PARENT: { title: "親", value: "PARENT" },
|
|
4
|
+
SPOUSE: { title: "配偶者", value: "SPOUSE" },
|
|
5
|
+
CHILD: { title: "子", value: "CHILD" },
|
|
6
|
+
SIBLING: { title: "兄弟姉妹", value: "SIBLING" },
|
|
7
|
+
OTHER: { title: "その他", value: "OTHER" },
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export const OPTIONS = [
|
|
11
|
+
{ title: VALUES.PARENT.title, value: VALUES.PARENT.value },
|
|
12
|
+
{ title: VALUES.SPOUSE.title, value: VALUES.SPOUSE.value },
|
|
13
|
+
{ title: VALUES.CHILD.title, value: VALUES.CHILD.value },
|
|
14
|
+
{ title: VALUES.SIBLING.title, value: VALUES.SIBLING.value },
|
|
15
|
+
{ title: VALUES.OTHER.title, value: VALUES.OTHER.value },
|
|
16
|
+
];
|
package/src/constants/index.js
CHANGED
|
@@ -6,6 +6,10 @@ export {
|
|
|
6
6
|
VALUES as BILLING_UNIT_TYPE_VALUES,
|
|
7
7
|
OPTIONS as BILLING_UNIT_TYPE_OPTIONS,
|
|
8
8
|
} from "./billing-unit-type.js";
|
|
9
|
+
export {
|
|
10
|
+
VALUES as BLOOD_TYPE_VALUES,
|
|
11
|
+
OPTIONS as BLOOD_TYPE_OPTIONS,
|
|
12
|
+
} from "./blood-type.js";
|
|
9
13
|
export {
|
|
10
14
|
VALUES as CONTRACT_STATUS_VALUES,
|
|
11
15
|
OPTIONS as CONTRACT_STATUS_OPTIONS,
|
|
@@ -15,6 +19,10 @@ export {
|
|
|
15
19
|
OPTIONS as DAY_TYPE_OPTIONS,
|
|
16
20
|
getDayType,
|
|
17
21
|
} from "./day-type.js";
|
|
22
|
+
export {
|
|
23
|
+
VALUES as EMERGENCY_CONTACT_RELATION_VALUES,
|
|
24
|
+
OPTIONS as EMERGENCY_CONTACT_RELATION_OPTIONS,
|
|
25
|
+
} from "./emergency-contact-relation.js";
|
|
18
26
|
export {
|
|
19
27
|
VALUES as EMPLOYMENT_STATUS_VALUES,
|
|
20
28
|
OPTIONS as EMPLOYMENT_STATUS_OPTIONS,
|
|
@@ -10,17 +10,15 @@ import { OPTIONS } from "../constants/prefectures.js";
|
|
|
10
10
|
* @type {Object.<string, AccessorImplementation>}
|
|
11
11
|
*/
|
|
12
12
|
const accessorImplementations = {
|
|
13
|
+
// 2025-12-08 削除可能
|
|
14
|
+
// `defAccessor("customerId")` で使用されていなければ削除。
|
|
13
15
|
customerId: {
|
|
14
|
-
enumerable: true,
|
|
15
16
|
get() {
|
|
16
17
|
return this?.customer?.docId;
|
|
17
18
|
},
|
|
18
|
-
set(
|
|
19
|
-
// No-op setter for read-only access
|
|
20
|
-
},
|
|
19
|
+
set() {},
|
|
21
20
|
},
|
|
22
21
|
fullAddress: {
|
|
23
|
-
enumerable: true,
|
|
24
22
|
get() {
|
|
25
23
|
// 同じオブジェクトに 'prefecture' アクセサが定義されていることを前提とします
|
|
26
24
|
const prefecture = this.prefecture || "";
|
|
@@ -28,53 +26,41 @@ const accessorImplementations = {
|
|
|
28
26
|
const address = this.address || "";
|
|
29
27
|
return `${prefecture}${city}${address}`;
|
|
30
28
|
},
|
|
31
|
-
set(
|
|
32
|
-
// No-op setter for read-only access
|
|
33
|
-
},
|
|
29
|
+
set() {},
|
|
34
30
|
},
|
|
35
31
|
fullName: {
|
|
36
|
-
enumerable: true,
|
|
37
32
|
get() {
|
|
38
33
|
if (!this.lastName || !this.firstName) return "";
|
|
39
34
|
return `${this.lastName} ${this.firstName}`;
|
|
40
35
|
},
|
|
41
|
-
set(
|
|
42
|
-
|
|
36
|
+
set() {},
|
|
37
|
+
},
|
|
38
|
+
fullNameKana: {
|
|
39
|
+
get() {
|
|
40
|
+
if (!this.lastNameKana || !this.firstNameKana) return "";
|
|
41
|
+
return `${this.lastNameKana} ${this.firstNameKana}`;
|
|
43
42
|
},
|
|
43
|
+
set() {},
|
|
44
44
|
},
|
|
45
45
|
prefecture: {
|
|
46
|
-
enumerable: true,
|
|
47
46
|
get() {
|
|
48
|
-
// if (!this.hasOwnProperty("prefCode")) {
|
|
49
|
-
// console.warn(
|
|
50
|
-
// "[アクセサ: prefecture] このオブジェクトに prefCode が定義されていません。"
|
|
51
|
-
// );
|
|
52
|
-
// return "";
|
|
53
|
-
// }
|
|
54
|
-
|
|
55
47
|
if (!this.prefCode) return ""; // No warning if prefCode is falsy but present
|
|
56
|
-
|
|
57
48
|
const result = OPTIONS.find(({ value }) => value === this.prefCode);
|
|
58
|
-
|
|
59
49
|
if (!result) {
|
|
60
50
|
console.warn(
|
|
61
51
|
`[アクセサ: prefecture] prefCode '${this.prefCode}' は OPTIONS に見つかりません。`
|
|
62
52
|
);
|
|
63
53
|
return "";
|
|
64
54
|
}
|
|
65
|
-
|
|
66
55
|
if (!result.hasOwnProperty("title")) {
|
|
67
56
|
console.warn(
|
|
68
57
|
`[アクセサ: prefecture] OPTIONS の prefCode '${this.prefCode}' に title が定義されていません。`
|
|
69
58
|
);
|
|
70
59
|
return "";
|
|
71
60
|
}
|
|
72
|
-
|
|
73
61
|
return result.title;
|
|
74
62
|
},
|
|
75
|
-
set(
|
|
76
|
-
// No-op setter for read-only access
|
|
77
|
-
},
|
|
63
|
+
set() {},
|
|
78
64
|
},
|
|
79
65
|
};
|
|
80
66
|
|
|
@@ -90,7 +76,7 @@ const accessorImplementations = {
|
|
|
90
76
|
*/
|
|
91
77
|
export const defAccessor = (
|
|
92
78
|
key,
|
|
93
|
-
{ configurable =
|
|
79
|
+
{ configurable = true, enumerable = true } = {}
|
|
94
80
|
) => {
|
|
95
81
|
const implementation = accessorImplementations[key];
|
|
96
82
|
if (!implementation) {
|