30 lines
1.0 KiB
TypeScript
30 lines
1.0 KiB
TypeScript
import { pgTable, text, integer, boolean, jsonb, timestamp, uuid } from 'drizzle-orm/pg-core';
|
|
import { tenants } from './tenants';
|
|
import { authProfiles } from './auth_profiles';
|
|
|
|
export const publicLinks = pgTable('public_links', {
|
|
id: uuid("id").primaryKey().defaultRandom(),
|
|
|
|
// Der öffentliche Token (z.B. "werkstatt-tablet-01")
|
|
token: text('token').notNull().unique(),
|
|
|
|
// Zuordnung zum Tenant (WICHTIG für die Datentrennung)
|
|
tenant: integer('tenant').references(() => tenants.id).notNull(),
|
|
|
|
defaultProfile: uuid('default_profile').references(() => authProfiles.id),
|
|
|
|
// Sicherheit
|
|
isProtected: boolean('is_protected').default(false).notNull(),
|
|
pinHash: text('pin_hash'),
|
|
|
|
// Konfiguration (JSON)
|
|
config: jsonb('config').default({}),
|
|
|
|
// Metadaten
|
|
name: text('name').notNull(),
|
|
description: text('description'),
|
|
|
|
active: boolean('active').default(true).notNull(),
|
|
createdAt: timestamp('created_at').defaultNow(),
|
|
updatedAt: timestamp('updated_at').defaultNow(),
|
|
}); |