feat: implement Daily management features and update UI

- Marked tasks as completed in TODO for Daily management service, data model, and interactive checkboxes.
- Added a new link to the Daily page in the Header component for easy navigation.
- Introduced DailyCheckbox model in Prisma schema and corresponding TypeScript interfaces for better data handling.
- Updated database schema to include daily checkboxes, enhancing task management capabilities.
This commit is contained in:
Julien Froidefond
2025-09-15 18:04:46 +02:00
parent 74ef79eb70
commit cf2e360ce9
14 changed files with 1423 additions and 10 deletions

View File

@@ -0,0 +1,25 @@
-- CreateTable
CREATE TABLE "dailies" (
"id" TEXT NOT NULL PRIMARY KEY,
"date" DATETIME NOT NULL,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL
);
-- CreateTable
CREATE TABLE "daily_checkboxes" (
"id" TEXT NOT NULL PRIMARY KEY,
"dailyId" TEXT NOT NULL,
"section" TEXT NOT NULL,
"text" TEXT NOT NULL,
"isChecked" BOOLEAN NOT NULL DEFAULT false,
"order" INTEGER NOT NULL DEFAULT 0,
"taskId" TEXT,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
CONSTRAINT "daily_checkboxes_dailyId_fkey" FOREIGN KEY ("dailyId") REFERENCES "dailies" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT "daily_checkboxes_taskId_fkey" FOREIGN KEY ("taskId") REFERENCES "tasks" ("id") ON DELETE SET NULL ON UPDATE CASCADE
);
-- CreateIndex
CREATE UNIQUE INDEX "dailies_date_key" ON "dailies"("date");

View File

@@ -0,0 +1,37 @@
/*
Warnings:
- You are about to drop the `dailies` table. If the table is not empty, all the data it contains will be lost.
- You are about to drop the column `dailyId` on the `daily_checkboxes` table. All the data in the column will be lost.
- You are about to drop the column `section` on the `daily_checkboxes` table. All the data in the column will be lost.
- Added the required column `date` to the `daily_checkboxes` table without a default value. This is not possible if the table is not empty.
*/
-- DropIndex
DROP INDEX "dailies_date_key";
-- DropTable
PRAGMA foreign_keys=off;
DROP TABLE "dailies";
PRAGMA foreign_keys=on;
-- RedefineTables
PRAGMA defer_foreign_keys=ON;
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_daily_checkboxes" (
"id" TEXT NOT NULL PRIMARY KEY,
"date" DATETIME NOT NULL,
"text" TEXT NOT NULL,
"isChecked" BOOLEAN NOT NULL DEFAULT false,
"order" INTEGER NOT NULL DEFAULT 0,
"taskId" TEXT,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
CONSTRAINT "daily_checkboxes_taskId_fkey" FOREIGN KEY ("taskId") REFERENCES "tasks" ("id") ON DELETE SET NULL ON UPDATE CASCADE
);
INSERT INTO "new_daily_checkboxes" ("createdAt", "id", "isChecked", "order", "taskId", "text", "updatedAt") SELECT "createdAt", "id", "isChecked", "order", "taskId", "text", "updatedAt" FROM "daily_checkboxes";
DROP TABLE "daily_checkboxes";
ALTER TABLE "new_daily_checkboxes" RENAME TO "daily_checkboxes";
CREATE INDEX "daily_checkboxes_date_idx" ON "daily_checkboxes"("date");
PRAGMA foreign_keys=ON;
PRAGMA defer_foreign_keys=OFF;

View File

@@ -29,7 +29,8 @@ model Task {
assignee String?
// Relations
taskTags TaskTag[]
taskTags TaskTag[]
dailyCheckboxes DailyCheckbox[]
@@unique([source, sourceId])
@@map("tasks")
@@ -65,3 +66,20 @@ model SyncLog {
@@map("sync_logs")
}
model DailyCheckbox {
id String @id @default(cuid())
date DateTime // Date de la checkbox (YYYY-MM-DD)
text String // Texte de la checkbox
isChecked Boolean @default(false)
order Int @default(0) // Ordre d'affichage pour cette date
taskId String? // Liaison optionnelle vers une tâche
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
// Relations
task Task? @relation(fields: [taskId], references: [id], onDelete: SetNull)
@@index([date])
@@map("daily_checkboxes")
}