feat: Add user management APIs, status enum, enhanced notifications

- Add updateUser and resetUserPassword admin endpoints
- Change company status from boolean to enum (registered, lead, customer, inactive)
- Add 'important' event type to calendar validators and email templates
- Add 1-hour-before event notifications cron job
- Add 18:00 evening notifications for next-day events
- Add contact description field support
- Fix count() function usage in admin service
- Add SQL migrations for schema changes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
richardtekula
2026-01-15 09:41:29 +01:00
parent 5d01fc9542
commit 70fa080455
13 changed files with 423 additions and 19 deletions

View File

@@ -5,6 +5,7 @@ export const roleEnum = pgEnum('role', ['admin', 'member']);
export const projectStatusEnum = pgEnum('project_status', ['active', 'completed', 'on_hold', 'cancelled']);
export const todoStatusEnum = pgEnum('todo_status', ['pending', 'in_progress', 'completed', 'cancelled']);
export const todoPriorityEnum = pgEnum('todo_priority', ['low', 'medium', 'high', 'urgent']);
export const companyStatusEnum = pgEnum('company_status', ['registered', 'lead', 'customer', 'inactive']);
// Users table - používatelia systému
export const users = pgTable('users', {
@@ -89,6 +90,7 @@ export const personalContacts = pgTable('personal_contacts', {
phone: text('phone').notNull(),
email: text('email').notNull(),
secondaryEmail: text('secondary_email'),
description: text('description'), // popis kontaktu
createdAt: timestamp('created_at').defaultNow().notNull(),
updatedAt: timestamp('updated_at').defaultNow().notNull(),
}, (table) => ({
@@ -128,7 +130,7 @@ export const companies = pgTable('companies', {
phone: text('phone'),
email: text('email'),
website: text('website'),
isActive: boolean('is_active').default(true).notNull(), // či je firma aktívna
status: companyStatusEnum('status').default('registered').notNull(), // stav firmy
createdBy: uuid('created_by').references(() => users.id, { onDelete: 'set null' }),
createdAt: timestamp('created_at').defaultNow().notNull(),
updatedAt: timestamp('updated_at').defaultNow().notNull(),