Add dueDate to reminders, remove reminder from notes

Schema changes:
- Added dueDate field to companyReminders table
- Removed reminderDate and reminderSent from notes table

Backend changes:
- Updated company-reminder.service with dueDate handling
- Added getUpcomingReminders function for dashboard
- Simplified note.service (removed reminder logic)
- Updated validators and routes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
richardtekula
2025-12-01 11:21:54 +01:00
parent 947d1d9b99
commit ffaf916f5e
6 changed files with 82 additions and 113 deletions

View File

@@ -81,7 +81,7 @@ export const updateTodoSchema = z.object({
dueDate: z.string().optional().or(z.literal('').or(z.null())),
});
// Note validators
// Note validators (without reminder functionality)
export const createNoteSchema = z.object({
title: z.string().max(255).optional(),
content: z
@@ -94,7 +94,6 @@ export const createNoteSchema = z.object({
projectId: z.string().uuid('Neplatný formát project ID').optional().or(z.literal('')),
todoId: z.string().uuid('Neplatný formát todo ID').optional().or(z.literal('')),
contactId: z.string().uuid('Neplatný formát contact ID').optional().or(z.literal('')),
reminderDate: z.string().optional().or(z.literal('')),
});
export const updateNoteSchema = z.object({
@@ -104,21 +103,22 @@ export const updateNoteSchema = z.object({
projectId: z.string().uuid('Neplatný formát project ID').optional().or(z.literal('').or(z.null())),
todoId: z.string().uuid('Neplatný formát todo ID').optional().or(z.literal('').or(z.null())),
contactId: z.string().uuid('Neplatný formát contact ID').optional().or(z.literal('').or(z.null())),
reminderDate: z.string().optional().or(z.literal('').or(z.null())),
});
// Company reminder validators
// Company reminder validators (with dueDate)
export const createCompanyReminderSchema = z.object({
description: z.string().min(1).max(1000),
dueDate: z.string().optional().or(z.literal('')),
isChecked: z.boolean().optional(),
});
export const updateCompanyReminderSchema = z.object({
description: z.string().min(1).max(1000).optional(),
dueDate: z.string().optional().or(z.literal('').or(z.null())),
isChecked: z.boolean().optional(),
}).refine(
(data) => data.description !== undefined || data.isChecked !== undefined,
{ message: 'Je potrebné zadať description alebo isChecked' }
(data) => data.description !== undefined || data.isChecked !== undefined || data.dueDate !== undefined,
{ message: 'Je potrebné zadať description, dueDate alebo isChecked' }
);
// Time Tracking validators