feat: enhance DailyCheckbox model and service for type management
- Added `DailyCheckboxType` to define checkbox types ('task' | 'meeting') in TypeScript.
- Updated `DailyCheckbox` model in Prisma schema to include `type` field with a default value of 'task'.
- Modified `DailyService` to handle checkbox type during creation and updates.
- Adjusted API route to accept checkbox type in requests.
- Refactored `DailyPageClient` to support type management in checkbox operations.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { prisma } from './database';
|
||||
import { DailyCheckbox, DailyView, CreateDailyCheckboxData, UpdateDailyCheckboxData, BusinessError } from '@/lib/types';
|
||||
import { DailyCheckbox, DailyView, CreateDailyCheckboxData, UpdateDailyCheckboxData, BusinessError, DailyCheckboxType } from '@/lib/types';
|
||||
|
||||
/**
|
||||
* Service pour la gestion des checkboxes daily
|
||||
@@ -67,6 +67,7 @@ export class DailyService {
|
||||
data: {
|
||||
date: normalizedDate,
|
||||
text: data.text.trim(),
|
||||
type: data.type ?? 'task',
|
||||
taskId: data.taskId,
|
||||
order,
|
||||
isChecked: data.isChecked ?? false
|
||||
@@ -85,6 +86,7 @@ export class DailyService {
|
||||
|
||||
if (data.text !== undefined) updateData.text = data.text.trim();
|
||||
if (data.isChecked !== undefined) updateData.isChecked = data.isChecked;
|
||||
if (data.type !== undefined) updateData.type = data.type;
|
||||
if (data.taskId !== undefined) updateData.taskId = data.taskId;
|
||||
if (data.order !== undefined) updateData.order = data.order;
|
||||
|
||||
@@ -214,6 +216,7 @@ export class DailyService {
|
||||
date: checkbox.date,
|
||||
text: checkbox.text,
|
||||
isChecked: checkbox.isChecked,
|
||||
type: checkbox.type as DailyCheckboxType,
|
||||
order: checkbox.order,
|
||||
taskId: checkbox.taskId,
|
||||
task: checkbox.task ? {
|
||||
|
||||
Reference in New Issue
Block a user