import { pgTable, uuid, text, timestamp, date, boolean, bigint, doublePrecision, jsonb, } from "drizzle-orm/pg-core" import { authUsers } from "./auth_users" export const authProfiles = pgTable("auth_profiles", { id: uuid("id").primaryKey().defaultRandom(), user_id: uuid("user_id").references(() => authUsers.id), tenant_id: bigint("tenant_id", { mode: "number" }).notNull(), created_at: timestamp("created_at", { withTimezone: true }) .notNull() .defaultNow(), first_name: text("first_name").notNull(), last_name: text("last_name").notNull(), full_name: text("full_name").generatedAlwaysAs( `((first_name || ' ') || last_name)` ), mobile_tel: text("mobile_tel"), fixed_tel: text("fixed_tel"), salutation: text("salutation"), employee_number: text("employee_number"), weekly_working_hours: doublePrecision("weekly_working_hours").default(0), annual_paid_leave_days: bigint("annual_paid_leave_days", { mode: "number" }), weekly_regular_working_hours: jsonb("weekly_regular_working_hours").default("{}"), clothing_size_top: text("clothing_size_top"), clothing_size_bottom: text("clothing_size_bottom"), clothing_size_shoe: text("clothing_size_shoe"), email_signature: text("email_signature").default("

Mit freundlichen Grüßen

"), birthday: date("birthday"), entry_date: date("entry_date").defaultNow(), automatic_hour_corrections: jsonb("automatic_hour_corrections").default("[]"), recreation_days_compensation: boolean("recreation_days_compensation") .notNull() .default(true), customer_for_portal: bigint("customer_for_portal", { mode: "number" }), pinned_on_navigation: jsonb("pinned_on_navigation").notNull().default("[]"), email: text("email"), token_id: text("token_id"), weekly_working_days: doublePrecision("weekly_working_days"), old_profile_id: uuid("old_profile_id"), temp_config: jsonb("temp_config"), state_code: text("state_code").default("DE-NI"), contract_type: text("contract_type"), position: text("position"), qualification: text("qualification"), address_street: text("address_street"), address_zip: text("address_zip"), address_city: text("address_city"), active: boolean("active").notNull().default(true), }) export type AuthProfile = typeof authProfiles.$inferSelect export type NewAuthProfile = typeof authProfiles.$inferInsert