option for more emails,fix jmap service,add table email accounts
This commit is contained in:
@@ -21,6 +21,19 @@ export const users = pgTable('users', {
|
||||
updatedAt: timestamp('updated_at').defaultNow().notNull(),
|
||||
});
|
||||
|
||||
// Email Accounts table - viacero emailových účtov pre jedného usera
|
||||
export const emailAccounts = pgTable('email_accounts', {
|
||||
id: uuid('id').primaryKey().defaultRandom(),
|
||||
userId: uuid('user_id').references(() => users.id, { onDelete: 'cascade' }).notNull(),
|
||||
email: text('email').notNull(),
|
||||
emailPassword: text('email_password').notNull(), // Heslo k emailovému účtu (encrypted)
|
||||
jmapAccountId: text('jmap_account_id').notNull(), // JMAP account ID z truemail
|
||||
isPrimary: boolean('is_primary').default(false).notNull(), // primárny email účet
|
||||
isActive: boolean('is_active').default(true).notNull(), // či je účet aktívny
|
||||
createdAt: timestamp('created_at').defaultNow().notNull(),
|
||||
updatedAt: timestamp('updated_at').defaultNow().notNull(),
|
||||
});
|
||||
|
||||
// Audit logs - kompletný audit trail všetkých akcií
|
||||
export const auditLogs = pgTable('audit_logs', {
|
||||
id: uuid('id').primaryKey().defaultRandom(),
|
||||
@@ -41,6 +54,7 @@ export const auditLogs = pgTable('audit_logs', {
|
||||
export const contacts = pgTable('contacts', {
|
||||
id: uuid('id').primaryKey().defaultRandom(),
|
||||
userId: uuid('user_id').references(() => users.id, { onDelete: 'cascade' }).notNull(),
|
||||
emailAccountId: uuid('email_account_id').references(() => emailAccounts.id, { onDelete: 'cascade' }).notNull(),
|
||||
email: text('email').notNull(),
|
||||
name: text('name'),
|
||||
notes: text('notes'),
|
||||
@@ -53,6 +67,7 @@ export const contacts = pgTable('contacts', {
|
||||
export const emails = pgTable('emails', {
|
||||
id: uuid('id').primaryKey().defaultRandom(),
|
||||
userId: uuid('user_id').references(() => users.id, { onDelete: 'cascade' }).notNull(),
|
||||
emailAccountId: uuid('email_account_id').references(() => emailAccounts.id, { onDelete: 'cascade' }).notNull(),
|
||||
contactId: uuid('contact_id').references(() => contacts.id, { onDelete: 'cascade' }),
|
||||
jmapId: text('jmap_id').unique(),
|
||||
messageId: text('message_id').unique(),
|
||||
|
||||
Reference in New Issue
Block a user