Remove multi-tenant company_id scoping from entire codebase
Drop company_id column from all 22 domain tables via migration. Remove companyId from JWT payload, auth plugins, all service method signatures (~215 occurrences), all route handlers (~105 occurrences), test runner, test suites, and frontend auth store/types. The company table stays as store settings (name, timezone). Tenant isolation in a SaaS deployment would be at the database level (one DB per customer) not the application level. All 107 API tests pass. Zero TSC errors across all packages.
This commit is contained in:
@@ -9,7 +9,7 @@ import {
|
||||
numeric,
|
||||
pgEnum,
|
||||
} from 'drizzle-orm/pg-core'
|
||||
import { companies, locations } from './stores.js'
|
||||
import { locations } from './stores.js'
|
||||
import { accounts } from './accounts.js'
|
||||
import { inventoryUnits, products } from './inventory.js'
|
||||
import { users } from './users.js'
|
||||
@@ -66,9 +66,6 @@ export const repairBatchApprovalEnum = pgEnum('repair_batch_approval', [
|
||||
// Defined before repairTickets because tickets FK to batches
|
||||
export const repairBatches = pgTable('repair_batch', {
|
||||
id: uuid('id').primaryKey().defaultRandom(),
|
||||
companyId: uuid('company_id')
|
||||
.notNull()
|
||||
.references(() => companies.id),
|
||||
locationId: uuid('location_id').references(() => locations.id),
|
||||
batchNumber: varchar('batch_number', { length: 50 }),
|
||||
accountId: uuid('account_id')
|
||||
@@ -97,9 +94,6 @@ export const repairBatches = pgTable('repair_batch', {
|
||||
|
||||
export const repairTickets = pgTable('repair_ticket', {
|
||||
id: uuid('id').primaryKey().defaultRandom(),
|
||||
companyId: uuid('company_id')
|
||||
.notNull()
|
||||
.references(() => companies.id),
|
||||
locationId: uuid('location_id').references(() => locations.id),
|
||||
repairBatchId: uuid('repair_batch_id').references(() => repairBatches.id),
|
||||
ticketNumber: varchar('ticket_number', { length: 50 }),
|
||||
@@ -163,9 +157,6 @@ export type RepairNoteInsert = typeof repairNotes.$inferInsert
|
||||
|
||||
export const repairServiceTemplates = pgTable('repair_service_template', {
|
||||
id: uuid('id').primaryKey().defaultRandom(),
|
||||
companyId: uuid('company_id')
|
||||
.notNull()
|
||||
.references(() => companies.id),
|
||||
name: varchar('name', { length: 255 }).notNull(),
|
||||
instrumentType: varchar('instrument_type', { length: 100 }),
|
||||
size: varchar('size', { length: 50 }),
|
||||
|
||||
Reference in New Issue
Block a user