initial commit

This commit is contained in:
ray
2026-07-12 10:01:39 -04:00
commit fc8290d668
185 changed files with 38831 additions and 0 deletions
@@ -0,0 +1,40 @@
/// <reference path="../pb_data/types.d.ts" />
//
// M9 — Rename legacy repair order status `delivered` to `final_close`.
//
// The frontend now uses `final_close` as the canonical terminal post-completion
// status. This migration updates existing repair orders so historical data and
// new UI filters/counts stay aligned.
//
migrate(
(db) => {
const col = db.findCollectionByNameOrId('repairOrders');
if (!col) {
console.warn('[M9] repairOrders collection not found — skipping');
return;
}
const records = Array.from(db.findRecordsByFilter('repairOrders', "status = 'delivered'", 'id', 1000));
let updated = 0;
for (const rec of records) {
rec.set('status', 'final_close');
db.saveRecord(rec);
updated++;
}
console.log(`[M9] renamed ${updated} repair order(s) to final_close`);
},
(db) => {
const col = db.findCollectionByNameOrId('repairOrders');
if (!col) return;
const records = Array.from(db.findRecordsByFilter('repairOrders', "status = 'final_close'", 'id', 1000));
let reverted = 0;
for (const rec of records) {
rec.set('status', 'delivered');
db.saveRecord(rec);
reverted++;
}
console.log(`[M9] reverted ${reverted} repair order(s) to delivered`);
}
);