feat: Add services, company documents, company timesheet export
- Add services table and CRUD endpoints (/api/services) - Add company documents upload/download functionality - Add company timesheet XLSX export endpoint - Remove admin requirement from event routes (all authenticated users can manage events) - Add service validators Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -284,6 +284,32 @@ export const timeEntries = pgTable('time_entries', {
|
||||
updatedAt: timestamp('updated_at').defaultNow().notNull(),
|
||||
});
|
||||
|
||||
// Company Documents table - dokumenty nahrané k firme
|
||||
export const companyDocuments = pgTable('company_documents', {
|
||||
id: uuid('id').primaryKey().defaultRandom(),
|
||||
companyId: uuid('company_id').references(() => companies.id, { onDelete: 'cascade' }).notNull(),
|
||||
fileName: text('file_name').notNull(), // unikátny názov súboru na disku
|
||||
originalName: text('original_name').notNull(), // pôvodný názov súboru
|
||||
filePath: text('file_path').notNull(), // cesta k súboru
|
||||
fileType: text('file_type').notNull(), // MIME typ
|
||||
fileSize: integer('file_size').notNull(), // veľkosť v bytoch
|
||||
description: text('description'),
|
||||
uploadedBy: uuid('uploaded_by').references(() => users.id, { onDelete: 'set null' }),
|
||||
uploadedAt: timestamp('uploaded_at').defaultNow().notNull(),
|
||||
createdAt: timestamp('created_at').defaultNow().notNull(),
|
||||
});
|
||||
|
||||
// Services table - služby ponúkané firmou
|
||||
export const services = pgTable('services', {
|
||||
id: uuid('id').primaryKey().defaultRandom(),
|
||||
name: text('name').notNull(),
|
||||
price: text('price').notNull(), // stored as text for flexibility with decimal
|
||||
description: text('description'),
|
||||
createdBy: uuid('created_by').references(() => users.id, { onDelete: 'set null' }),
|
||||
createdAt: timestamp('created_at').defaultNow().notNull(),
|
||||
updatedAt: timestamp('updated_at').defaultNow().notNull(),
|
||||
});
|
||||
|
||||
// Messages table - interná komunikácia medzi používateľmi
|
||||
export const messages = pgTable('messages', {
|
||||
id: uuid('id').primaryKey().defaultRandom(),
|
||||
|
||||
Reference in New Issue
Block a user