fixed payout locks & time sensitive todos & minor ui updates on chores view

This commit is contained in:
JCEEE
2026-08-04 11:38:38 +01:00
parent 7603c3eb21
commit c38ca43f0b
11 changed files with 289 additions and 164 deletions
+36
View File
@@ -284,6 +284,42 @@ export async function migrate(): Promise<void> {
console.log(` ↳ rewards collection not found (will be created by seed)`);
}
// Ensure rewards.claimable + rewards.settleDate exist (payday-gated bonuses)
const rewardsCol2 = await getCollection("rewards");
if (rewardsCol2) {
const fieldNames = rewardsCol2.fields.map((f: any) => f.name);
const missing: any[] = [];
if (!fieldNames.includes("claimable")) {
missing.push({
name: "claimable",
type: "select",
required: true,
values: ["immediate", "payday"],
maxSelect: 1,
});
}
if (!fieldNames.includes("settleDate")) {
missing.push({ name: "settleDate", type: "text", required: false });
}
if (missing.length) {
console.log("[migrate] Adding rewards.claimable/settleDate (payday gating)...");
rewardsCol2.fields.push(...missing);
await updateCollection(rewardsCol2.id, {
name: "rewards",
type: "base",
listRule: rewardsCol2.listRule,
viewRule: rewardsCol2.viewRule,
createRule: rewardsCol2.createRule,
updateRule: rewardsCol2.updateRule,
deleteRule: rewardsCol2.deleteRule,
fields: rewardsCol2.fields,
});
console.log(" ✓ rewards.claimable/settleDate added");
} else {
console.log(` ↳ rewards.claimable/settleDate already exist`);
}
}
// ── 3. Update settings collection (drop old fields) ──
const settingsCol = await getCollection("settings");
if (settingsCol) {