@shisyamo4131/air-guard-v2-schemas 1.3.1-dev.13 → 1.3.1-dev.15

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shisyamo4131/air-guard-v2-schemas",
3
- "version": "1.3.1-dev.13",
3
+ "version": "1.3.1-dev.15",
4
4
  "description": "Schemas for AirGuard V2",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -170,12 +170,20 @@
170
170
  * - @param {Object|string} key - The combined key string or object
171
171
  * - @returns {Array<string>} - Array containing [siteId, shiftType, date]
172
172
  * - @throws {Error} - If the key is invalid.
173
+ * @method toggleLock - Toggle the lock status of an OperationResult document
174
+ * - @param {string} docId - Document ID
175
+ * - @param {boolean} value - Lock status value
176
+ * - @returns {Promise<void>}
173
177
  *
174
- * @override create - Override create method to indicate not implemented
178
+ * @override
179
+ * @method create - Override create method to indicate not implemented
175
180
  * - Creation of OperationBilling instances is not implemented, as billing records are typically
176
181
  * generated through the OperationResult class.
182
+ * @method update - Override update method to allow editing even when isLocked is true
183
+ * @method delete - Override delete method to allow deletion even when isLocked is true
177
184
  *****************************************************************************/
178
185
  import OperationResult from "./OperationResult.js";
186
+ import Operation from "./Operation.js";
179
187
 
180
188
  export default class OperationBilling extends OperationResult {
181
189
  static className = "稼働請求";
@@ -189,4 +197,45 @@ export default class OperationBilling extends OperationResult {
189
197
  async create() {
190
198
  return Promise.reject(new Error("[OperationBilling.js] Not implemented."));
191
199
  }
200
+
201
+ /**
202
+ * Override update method to allow editing even when isLocked is true
203
+ * @param {*} options
204
+ * @returns {Promise<void>}
205
+ */
206
+ async update(options = {}) {
207
+ // isLockedのチェックをスキップして、親クラス(Operation)のupdateを直接呼び出す
208
+ return await Operation.prototype.update.call(this, options);
209
+ }
210
+
211
+ /**
212
+ * Override delete method to allow deletion even when isLocked is true
213
+ * @param {*} options
214
+ * @returns {Promise<void>}
215
+ */
216
+ async delete(options = {}) {
217
+ // isLockedのチェックをスキップして、親クラス(Operation)のdeleteを直接呼び出す
218
+ return await Operation.prototype.delete.call(this, options);
219
+ }
220
+
221
+ /**
222
+ * Toggle the lock status of an OperationResult document
223
+ * @param {string} docId - Document ID
224
+ * @param {boolean} value - Lock status value
225
+ */
226
+ static async toggleLock(docId, value) {
227
+ if (!docId || typeof docId !== "string") {
228
+ throw new Error("Invalid docId provided to toggleLock method");
229
+ }
230
+ if (typeof value !== "boolean") {
231
+ throw new Error("Invalid value provided to toggleLock method");
232
+ }
233
+ const instance = new OperationBilling();
234
+ const doc = await instance.fetchDoc({ docId });
235
+ if (!doc) {
236
+ throw new Error(`OperationResult document with ID ${docId} not found`);
237
+ }
238
+ doc.isLocked = value;
239
+ await doc.update();
240
+ }
192
241
  }
@@ -205,7 +205,7 @@ const classProps = {
205
205
  label: "資格残業(調整)",
206
206
  default: 0,
207
207
  }),
208
- billingDateAt: defField("dateAt", { label: "請求日付" }),
208
+ billingDateAt: defField("dateAt", { label: "請求締日" }),
209
209
  employees: defField("array", { customClass: OperationResultDetail }),
210
210
  outsourcers: defField("array", {
211
211
  customClass: OperationResultDetail,
@@ -216,7 +216,7 @@ const classProps = {
216
216
  }),
217
217
  agreement: defField("object", { label: "取極め", customClass: Agreement }),
218
218
  allowEmptyAgreement: defField("check", {
219
- label: "取極めなしを無視",
219
+ label: "取極めなしを許容",
220
220
  default: false,
221
221
  }),
222
222
  };