commit working state

Too many changes to split them up. This commit contains roughly two months worth of work.

This commit introduces the first aggregate and rewrites the ticket system to follow DDD patterns.
It adds Spartan NG as the new component library. TanStack Query to replace GraphQL. Oh and Prisma is
almost over as well.
This commit is contained in:
Marcel Arndt
2026-01-19 12:21:48 +01:00
parent 62e663d053
commit ce676f20a4
334 changed files with 64333 additions and 52554 deletions
@@ -0,0 +1,47 @@
/*
Warnings:
- A unique constraint covering the columns `[tourId,ticketId]` on the table `TourFile` will be added. If there are existing duplicate values, this will fail.
*/
-- DropIndex
DROP INDEX "TourFile_tourId_ticketId_idx";
-- AlterTable
ALTER TABLE "Patient" ADD COLUMN "insuranceNo" TEXT;
-- AlterTable
ALTER TABLE "PatientSource" ADD COLUMN "stammVersNr" TEXT;
-- AlterTable
ALTER TABLE "PatientStaging" ADD COLUMN "insuranceNo" TEXT;
-- AlterTable
ALTER TABLE "Ticket" ADD COLUMN "approvalFullRequestMessageId" TEXT,
ADD COLUMN "approvalIsOverriden" BOOLEAN NOT NULL DEFAULT false,
ADD COLUMN "approvalLastInteractionAt" TIMESTAMP(3),
ADD COLUMN "approvalPreInquiryMessageId" TEXT,
ADD COLUMN "approvalRecipient" TEXT,
ADD COLUMN "approvalReminderCount" INTEGER DEFAULT 0,
ADD COLUMN "approvalRequestedAt" TIMESTAMP(3),
ADD COLUMN "approvalRequirement" TEXT DEFAULT 'UNKNOWN',
ADD COLUMN "approvalStatus" TEXT DEFAULT 'NOT_STARTED',
ADD COLUMN "hasDigitalTransportDocument" BOOLEAN NOT NULL DEFAULT false,
ADD COLUMN "hasPhysicalTransportDocument" BOOLEAN NOT NULL DEFAULT false,
ADD COLUMN "patientId" UUID,
ADD COLUMN "stage" TEXT DEFAULT 'DRAFT',
ADD COLUMN "updatedAt" TIMESTAMP(3),
ALTER COLUMN "id" DROP DEFAULT,
ALTER COLUMN "currentState" DROP NOT NULL;
-- AlterTable
ALTER TABLE "Tour" ADD COLUMN "insuranceNo" TEXT;
-- AlterTable
ALTER TABLE "TourSource" ADD COLUMN "stammVersNr" TEXT;
-- AlterTable
ALTER TABLE "TourStaging" ADD COLUMN "insuranceNo" TEXT;
-- CreateIndex
CREATE UNIQUE INDEX "TourFile_tourId_ticketId_key" ON "TourFile"("tourId", "ticketId");
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "Ticket" ADD COLUMN "lastStageBeforeClosed" TEXT;
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "Tour" ADD COLUMN "optimizationInMinutes" INTEGER NOT NULL DEFAULT 0;
@@ -59,6 +59,7 @@ model TourSource {
itName String?
kkId String?
krankenkasse String?
stammVersNr String?
patId String?
patName String?
patSurname String?
@@ -196,6 +197,7 @@ model PatientSource {
birthday String?
kkId String?
krankenkasse String?
stammVersNr String?
pflegestufe String?
behinderung1 String?
behinderung2 String?
@@ -223,6 +225,7 @@ model TourStaging {
patientCity String?
healthInsurance String?
healthInsuranceNumber String?
insuranceNo String?
type String?
category String?
@@ -282,6 +285,7 @@ model PatientStaging {
birthday DateTime?
healthinsuranceId String?
healthinsurance String?
insuranceNo String?
careDegree String?
disabilityMark1 String?
disabilityMark2 String?
@@ -371,6 +375,7 @@ model Tour {
patientCity String?
healthInsurance String?
healthInsuranceNumber String?
insuranceNo String?
type String?
category String?
@@ -414,11 +419,12 @@ model Tour {
companyName String?
schwerlast Boolean @default(false)
createdAt DateTime?
updatedAt DateTime?
deletedAt DateTime?
Ticket Ticket? @relation(fields: [ticketId], references: [id])
ticketId String? @db.Uuid
createdAt DateTime?
updatedAt DateTime?
deletedAt DateTime?
optimizationInMinutes Int @default(0)
Ticket Ticket? @relation(fields: [ticketId], references: [id])
ticketId String? @db.Uuid
}
model TourFile {
@@ -435,7 +441,7 @@ model TourFile {
createdAt DateTime? @default(now())
@@index([tourId, ticketId])
@@unique([tourId, ticketId])
}
model Patient {
@@ -449,6 +455,7 @@ model Patient {
birthday DateTime?
healthinsuranceId String?
healthinsurance String?
insuranceNo String?
careDegree String?
disabilityMark1 String?
disabilityMark2 String?
@@ -480,17 +487,36 @@ enum ApprovalState {
}
model Ticket {
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
id String @id @db.Uuid
patientId String? @db.Uuid
stage String? @default("DRAFT")
approvalRequirement String? @default("UNKNOWN")
approvalStatus String? @default("NOT_STARTED")
approvalRequestedAt DateTime?
approvalLastInteractionAt DateTime?
approvalReminderCount Int? @default(0)
approvalRecipient String?
approvalPreInquiryMessageId String?
approvalFullRequestMessageId String?
approvalIsOverriden Boolean @default(false)
hasPhysicalTransportDocument Boolean @default(false)
hasDigitalTransportDocument Boolean @default(false)
lastStageBeforeClosed String?
updatedAt DateTime? @updatedAt
createdAt DateTime @default(now())
tours Tour[]
state TicketStateHistory[]
currentState TicketValidationState
currentState TicketValidationState?
notes String[]
errors String[]
isUrgent Boolean @default(false)
urgency DateTime @default("2099-12-31T23:59:59.999Z")
isUrgent Boolean @default(false)
urgency DateTime @default("2099-12-31T23:59:59.999Z")
approvalState ApprovalState?
documentInfo Json? @default("{\"approval\": {\"isNeeded\": null, \"whoRequested\": \"\",\"answeredFrom\": \"\"},\"tdLocation\": \"\"}")
createdAt DateTime @default(now())
documentInfo Json? @default("{\"approval\": {\"isNeeded\": null, \"whoRequested\": \"\",\"answeredFrom\": \"\"},\"tdLocation\": \"\"}")
}
model TicketStateHistory {