fixed payout locks & time sensitive todos & minor ui updates on chores view
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user