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

@@ -132,11 +132,12 @@ export const projects = pgTable('projects', {
updatedAt: timestamp('updated_at').defaultNow().notNull(),
});
// Company reminders table - jednoduché pripomienky naviazané na firmu
// Company reminders table - pripomienky naviazané na firmu s dátumom
export const companyReminders = pgTable('company_remind', {
id: uuid('id').primaryKey().defaultRandom(),
companyId: uuid('company_id').references(() => companies.id, { onDelete: 'cascade' }).notNull(),
description: text('description').notNull(),
dueDate: timestamp('due_date'), // kedy má byť splnená
isChecked: boolean('is_checked').default(false).notNull(),
createdAt: timestamp('created_at').defaultNow().notNull(),
updatedAt: timestamp('updated_at').defaultNow().notNull(),
@@ -181,7 +182,7 @@ export const todoUsers = pgTable('todo_users', {
todoUserUnique: unique('todo_user_unique').on(table.todoId, table.userId),
}));
// Notes table - poznámky
// Notes table - poznámky (bez reminder funkcionalít)
export const notes = pgTable('notes', {
id: uuid('id').primaryKey().defaultRandom(),
title: text('title'),
@@ -190,8 +191,6 @@ export const notes = pgTable('notes', {
projectId: uuid('project_id').references(() => projects.id, { onDelete: 'cascade' }), // alebo projektu
todoId: uuid('todo_id').references(() => todos.id, { onDelete: 'cascade' }), // alebo todo
contactId: uuid('contact_id').references(() => contacts.id, { onDelete: 'cascade' }), // alebo kontaktu
reminderDate: timestamp('reminder_date'), // dátum a čas pre reminder
reminderSent: boolean('reminder_sent').default(false).notNull(), // či už bol reminder odoslaný
createdBy: uuid('created_by').references(() => users.id, { onDelete: 'set null' }),
createdAt: timestamp('created_at').defaultNow().notNull(),
updatedAt: timestamp('updated_at').defaultNow().notNull(),