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(), userId: uuid("user_id").references(() => authUsers.id), tenantId: bigint("tenant_id", { mode: "number" }).notNull(), createdAt: timestamp("created_at", { withTimezone: true }) .notNull() .defaultNow(), firstName: text("first_name").notNull(), lastName: text("last_name").notNull(), fullName: text("full_name").generatedAlwaysAs( `((first_name || ' ') || last_name)` ), mobileTel: text("mobile_tel"), fixedTel: text("fixed_tel"), salutation: text("salutation"), employeeNumber: text("employee_number"), weeklyWorkingHours: doublePrecision("weekly_working_hours").default(0), annualPaidLeaveDays: bigint("annual_paid_leave_days", { mode: "number" }), weeklyRegularWorkingHours: jsonb("weekly_regular_working_hours").default("{}"), clothingSizeTop: text("clothing_size_top"), clothingSizeBottom: text("clothing_size_bottom"), clothingSizeShoe: text("clothing_size_shoe"), emailSignature: text("email_signature").default("

Mit freundlichen Grüßen

"), birthday: date("birthday"), entryDate: date("entry_date").defaultNow(), automaticHourCorrections: jsonb("automatic_hour_corrections").default("[]"), recreationDaysCompensation: boolean("recreation_days_compensation") .notNull() .default(true), customerForPortal: bigint("customer_for_portal", { mode: "number" }), pinnedOnNavigation: jsonb("pinned_on_navigation").notNull().default("[]"), email: text("email"), tokenId: text("token_id"), weeklyWorkingDays: doublePrecision("weekly_working_days"), oldProfileId: uuid("old_profile_id"), tempConfig: jsonb("temp_config"), stateCode: text("state_code").default("DE-NI"), contractType: text("contract_type"), position: text("position"), qualification: text("qualification"), addressStreet: text("address_street"), addressZip: text("address_zip"), addressCity: text("address_city"), active: boolean("active").notNull().default(true), }) export type AuthProfile = typeof authProfiles.$inferSelect export type NewAuthProfile = typeof authProfiles.$inferInsert