Refactor Protected and Public Routes for Consistent Loading UI; Enhance HomePage with User Company and Branch Details; Update LoginPage Layout; Introduce User Relations in Auth Services
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { pgTable, uuid, varchar, timestamp } from "drizzle-orm/pg-core";
|
||||
import { createInsertSchema, createSelectSchema } from "drizzle-zod";
|
||||
import { companies } from "./companies";
|
||||
|
||||
export const branches = pgTable("branches", {
|
||||
id: uuid("id").primaryKey().defaultRandom(),
|
||||
companyId: uuid("company_id")
|
||||
.notNull()
|
||||
.references(() => companies.id, { onDelete: "cascade" }),
|
||||
name: varchar("name", { length: 255 }).notNull(),
|
||||
address: varchar("address", { length: 500 }),
|
||||
city: varchar("city", { length: 100 }),
|
||||
country: varchar("country", { length: 100 }),
|
||||
createdAt: timestamp("created_at").defaultNow().notNull(),
|
||||
updatedAt: timestamp("updated_at").defaultNow().notNull(),
|
||||
});
|
||||
|
||||
// Zod schemas for validation
|
||||
export const insertBranchSchema = createInsertSchema(branches);
|
||||
export const selectBranchSchema = createSelectSchema(branches);
|
||||
|
||||
// Type exports
|
||||
export type Branch = typeof branches.$inferSelect;
|
||||
export type NewBranch = typeof branches.$inferInsert;
|
||||
Reference in New Issue
Block a user