feat: Add internal chat system and network access support
- Add messages table schema with soft delete support - Add message service, controller and routes - Update CORS to allow local network IPs - Update server to listen on 0.0.0.0 - Fix cookie sameSite for local network development Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -283,3 +283,16 @@ export const timeEntries = pgTable('time_entries', {
|
||||
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(),
|
||||
senderId: uuid('sender_id').references(() => users.id, { onDelete: 'cascade' }).notNull(),
|
||||
receiverId: uuid('receiver_id').references(() => users.id, { onDelete: 'cascade' }).notNull(),
|
||||
content: text('content').notNull(),
|
||||
isRead: boolean('is_read').default(false).notNull(),
|
||||
deletedBySender: boolean('deleted_by_sender').default(false).notNull(), // soft delete pre odosielateľa
|
||||
deletedByReceiver: boolean('deleted_by_receiver').default(false).notNull(), // soft delete pre príjemcu
|
||||
createdAt: timestamp('created_at').defaultNow().notNull(),
|
||||
updatedAt: timestamp('updated_at').defaultNow().notNull(),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user