feat: Add IČO and DIČ fields to companies

- Add ico and dic columns to companies table schema
- Add validation for ico and dic in createCompanySchema and updateCompanySchema
- Update company.service.js to include ico and dic in all CRUD operations
- Include migration file for database changes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
richardtekula
2026-01-30 07:47:22 +01:00
parent 159c22da16
commit 09f4c72acb
6 changed files with 3669 additions and 2 deletions

View File

@@ -0,0 +1,19 @@
ALTER TYPE "public"."role" ADD VALUE 'team_leader' BEFORE 'member';--> statement-breakpoint
ALTER TABLE "companies" ADD COLUMN "postal_code" text;--> statement-breakpoint
ALTER TABLE "companies" ADD COLUMN "ico" text;--> statement-breakpoint
ALTER TABLE "companies" ADD COLUMN "dic" text;--> statement-breakpoint
ALTER TABLE "kurzy" ADD COLUMN "farba" varchar(20);--> statement-breakpoint
ALTER TABLE "kurzy" ADD COLUMN "datum_od" date;--> statement-breakpoint
ALTER TABLE "kurzy" ADD COLUMN "datum_do" date;--> statement-breakpoint
ALTER TABLE "services" ADD COLUMN "pricing_tiers" text;--> statement-breakpoint
ALTER TABLE "time_entries" ADD COLUMN "paused_at" timestamp;--> statement-breakpoint
ALTER TABLE "time_entries" ADD COLUMN "paused_duration" integer DEFAULT 0 NOT NULL;--> statement-breakpoint
ALTER TABLE "ucastnici" ADD COLUMN "firma_ico" varchar(20);--> statement-breakpoint
ALTER TABLE "ucastnici" ADD COLUMN "firma_dic" varchar(20);--> statement-breakpoint
ALTER TABLE "ucastnici" ADD COLUMN "firma_ic_dph" varchar(25);--> statement-breakpoint
ALTER TABLE "ucastnici" ADD COLUMN "firma_sidlo" text;--> statement-breakpoint
ALTER TABLE "ucastnici" ADD COLUMN "needs_followup" boolean DEFAULT false NOT NULL;--> statement-breakpoint
ALTER TABLE "users" ADD COLUMN "last_seen" timestamp;--> statement-breakpoint
ALTER TABLE "registracie" DROP COLUMN "datum_od";--> statement-breakpoint
ALTER TABLE "registracie" DROP COLUMN "datum_do";--> statement-breakpoint
ALTER TABLE "registracie" DROP COLUMN "pocet_ucastnikov";

File diff suppressed because it is too large Load Diff

View File

@@ -15,6 +15,13 @@
"when": 1768990516243,
"tag": "0001_living_natasha_romanoff",
"breakpoints": true
},
{
"idx": 2,
"version": "7",
"when": 1769754011560,
"tag": "0002_soft_black_tarantula",
"breakpoints": true
}
]
}

View File

@@ -132,6 +132,8 @@ export const companies = pgTable('companies', {
phone: text('phone'),
email: text('email'),
website: text('website'),
ico: text('ico'), // IČO - Company ID number
dic: text('dic'), // DIČ - Tax ID number
status: companyStatusEnum('status').default('registered').notNull(), // stav firmy
createdBy: uuid('created_by').references(() => users.id, { onDelete: 'set null' }),
createdAt: timestamp('created_at').defaultNow().notNull(),