@@ -25,6 +25,23 @@ const DEFAULT_LITANIES = [
|
||||
"Litany 6",
|
||||
];
|
||||
|
||||
function itemConfig(
|
||||
label: string,
|
||||
config: Record<string, unknown> = {}
|
||||
): Record<string, unknown> {
|
||||
const semanticByLabel: Record<string, string> = {
|
||||
Work: "work",
|
||||
Exercise: "exercise",
|
||||
Prayer: "prayer",
|
||||
Litanies: "litanies",
|
||||
Teaching: "teaching",
|
||||
"Class 1": "class",
|
||||
"Class 2": "class",
|
||||
};
|
||||
const semanticKey = semanticByLabel[label];
|
||||
return semanticKey ? { ...config, semanticKey } : config;
|
||||
}
|
||||
|
||||
async function seed() {
|
||||
const existing = await db.select().from(users).limit(1);
|
||||
if (existing.length > 0) {
|
||||
@@ -58,13 +75,13 @@ async function seed() {
|
||||
isSystem: true,
|
||||
sortPriority: 0,
|
||||
items: [
|
||||
{ type: "duration", label: "Work", config: { targetHours: 7.5 }, sortOrder: 0 },
|
||||
{ type: "checkbox", label: "Exercise", config: {}, sortOrder: 1 },
|
||||
{ type: "duration", label: "Work", config: itemConfig("Work", { targetHours: 7.5 }), sortOrder: 0 },
|
||||
{ type: "checkbox", label: "Exercise", config: itemConfig("Exercise"), sortOrder: 1 },
|
||||
{ type: "reading", label: "Read", config: {}, sortOrder: 2 },
|
||||
{ type: "timeblock", label: "Class 1", config: { scheduledTime: "18:00" }, sortOrder: 3 },
|
||||
{ type: "timeblock", label: "Class 2", config: { scheduledTime: "20:00" }, sortOrder: 4 },
|
||||
{ type: "checklist", label: "Prayer", config: { checklistSize: 5 }, sortOrder: 5 },
|
||||
{ type: "checklist", label: "Litanies", config: { checklistSize: 6 }, sortOrder: 6 },
|
||||
{ type: "timeblock", label: "Class 1", config: itemConfig("Class 1", { scheduledTime: "18:00" }), sortOrder: 3 },
|
||||
{ type: "timeblock", label: "Class 2", config: itemConfig("Class 2", { scheduledTime: "20:00" }), sortOrder: 4 },
|
||||
{ type: "checklist", label: "Prayer", config: itemConfig("Prayer", { checklistSize: 5 }), sortOrder: 5 },
|
||||
{ type: "checklist", label: "Litanies", config: itemConfig("Litanies", { checklistSize: 6 }), sortOrder: 6 },
|
||||
{ type: "note", label: "Notes", config: {}, sortOrder: 7 },
|
||||
],
|
||||
},
|
||||
@@ -75,10 +92,10 @@ async function seed() {
|
||||
isSystem: true,
|
||||
sortPriority: 0,
|
||||
items: [
|
||||
{ type: "checkbox", label: "Exercise", config: {}, sortOrder: 0 },
|
||||
{ type: "checkbox", label: "Exercise", config: itemConfig("Exercise"), sortOrder: 0 },
|
||||
{ type: "reading", label: "Read", config: {}, sortOrder: 1 },
|
||||
{ type: "checklist", label: "Prayer", config: { checklistSize: 5 }, sortOrder: 2 },
|
||||
{ type: "checklist", label: "Litanies", config: { checklistSize: 6 }, sortOrder: 3 },
|
||||
{ type: "checklist", label: "Prayer", config: itemConfig("Prayer", { checklistSize: 5 }), sortOrder: 2 },
|
||||
{ type: "checklist", label: "Litanies", config: itemConfig("Litanies", { checklistSize: 6 }), sortOrder: 3 },
|
||||
{ type: "note", label: "Notes", config: {}, sortOrder: 4 },
|
||||
],
|
||||
},
|
||||
@@ -90,9 +107,9 @@ async function seed() {
|
||||
sortPriority: 0,
|
||||
items: [
|
||||
{ type: "reading", label: "Read", config: {}, sortOrder: 0 },
|
||||
{ type: "checkbox", label: "Exercise", config: {}, sortOrder: 1 },
|
||||
{ type: "checklist", label: "Prayer", config: { checklistSize: 5 }, sortOrder: 2 },
|
||||
{ type: "checklist", label: "Litanies", config: { checklistSize: 6 }, sortOrder: 3 },
|
||||
{ type: "checkbox", label: "Exercise", config: itemConfig("Exercise"), sortOrder: 1 },
|
||||
{ type: "checklist", label: "Prayer", config: itemConfig("Prayer", { checklistSize: 5 }), sortOrder: 2 },
|
||||
{ type: "checklist", label: "Litanies", config: itemConfig("Litanies", { checklistSize: 6 }), sortOrder: 3 },
|
||||
{ type: "note", label: "Notes", config: {}, sortOrder: 4 },
|
||||
],
|
||||
},
|
||||
@@ -104,11 +121,11 @@ async function seed() {
|
||||
sortPriority: 10,
|
||||
items: [
|
||||
{ type: "duration", label: "Work", config: { targetHours: 7.5 }, sortOrder: 0 },
|
||||
{ type: "checkbox", label: "Teaching", config: {}, sortOrder: 1 },
|
||||
{ type: "checkbox", label: "Exercise", config: {}, sortOrder: 2 },
|
||||
{ type: "checkbox", label: "Teaching", config: itemConfig("Teaching"), sortOrder: 1 },
|
||||
{ type: "checkbox", label: "Exercise", config: itemConfig("Exercise"), sortOrder: 2 },
|
||||
{ type: "reading", label: "Read", config: {}, sortOrder: 3 },
|
||||
{ type: "checklist", label: "Prayer", config: { checklistSize: 5 }, sortOrder: 4 },
|
||||
{ type: "checklist", label: "Litanies", config: { checklistSize: 6 }, sortOrder: 5 },
|
||||
{ type: "checklist", label: "Prayer", config: itemConfig("Prayer", { checklistSize: 5 }), sortOrder: 4 },
|
||||
{ type: "checklist", label: "Litanies", config: itemConfig("Litanies", { checklistSize: 6 }), sortOrder: 5 },
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user