feat(DailyService): implement toggleCheckbox method for direct checkbox state updates
This commit is contained in:
@@ -130,6 +130,27 @@ export class DailyService {
|
||||
return this.mapPrismaCheckbox(checkbox);
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle l'état d'une checkbox par son ID (indépendant de la date)
|
||||
*/
|
||||
async toggleCheckbox(checkboxId: string): Promise<DailyCheckbox> {
|
||||
const existing = await prisma.dailyCheckbox.findUnique({
|
||||
where: { id: checkboxId },
|
||||
});
|
||||
|
||||
if (!existing) {
|
||||
throw new BusinessError('Checkbox non trouvée');
|
||||
}
|
||||
|
||||
const updated = await prisma.dailyCheckbox.update({
|
||||
where: { id: checkboxId },
|
||||
data: { isChecked: !existing.isChecked, updatedAt: new Date() },
|
||||
include: { task: true, user: true },
|
||||
});
|
||||
|
||||
return this.mapPrismaCheckbox(updated);
|
||||
}
|
||||
|
||||
/**
|
||||
* Supprime une checkbox
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user