This commit is contained in:
Roberto Musso
2026-02-25 07:31:50 +01:00
parent 5445bb0eec
commit 50b7fa784c
8 changed files with 335 additions and 86 deletions

View File

@@ -335,6 +335,30 @@ const tasksRouter = router({
getDb().delete(tasks).where(eq(tasks.id, input.id)).run();
return { success: true as const };
}),
dueToday: publicProcedure.query(() => {
const now = new Date();
const endOfToday = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59, 999).getTime();
return getDb()
.select({
id: tasks.id,
title: tasks.title,
priority: tasks.priority,
dueDate: tasks.dueDate,
projectId: tasks.projectId,
})
.from(tasks)
.where(
and(
sql`${tasks.dueDate} IS NOT NULL`,
sql`${tasks.dueDate} <= ${endOfToday}`,
sql`${tasks.status} != 'done'`,
)
)
.orderBy(asc(tasks.dueDate))
.all();
}),
});
const checkpointsRouter = router({
@@ -512,6 +536,13 @@ const settingsRouter = router({
getStore().set('sidebarCollapsed', input.collapsed);
return null;
}),
getUserName: publicProcedure.query(() => getStore().get('userName')),
setUserName: publicProcedure
.input(z.object({ name: z.string() }))
.mutation(({ input }) => {
getStore().set('userName', input.name);
return null;
}),
});
const aiRouter = router({

View File

@@ -4,6 +4,7 @@ interface AppSettings {
sidebarCollapsed: boolean;
aiProvider: string;
encryptedTokens: Record<string, string>;
userName: string;
}
let _store: Store<AppSettings> | null = null;
@@ -15,6 +16,7 @@ export function getStore(): Store<AppSettings> {
sidebarCollapsed: false,
aiProvider: 'copilot',
encryptedTokens: {},
userName: 'there',
},
});
}