pdf upload checkpoint1
This commit is contained in:
@@ -52,6 +52,7 @@ model Patient {
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
appointments Appointment[]
|
||||
claims Claim[]
|
||||
pdfs ClaimPdf[]
|
||||
}
|
||||
|
||||
model Appointment {
|
||||
@@ -107,6 +108,7 @@ model Claim {
|
||||
staff Staff? @relation("ClaimStaff", fields: [staffId], references: [id])
|
||||
|
||||
serviceLines ServiceLine[]
|
||||
pdf ClaimPdf[]
|
||||
}
|
||||
|
||||
model ServiceLine {
|
||||
@@ -130,6 +132,21 @@ model InsuranceCredential {
|
||||
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([userId, siteKey])
|
||||
@@index([userId])
|
||||
@@unique([userId, siteKey])
|
||||
}
|
||||
|
||||
model ClaimPdf {
|
||||
id Int @id @default(autoincrement())
|
||||
patientId Int
|
||||
claimId Int?
|
||||
filename String
|
||||
pdfData Bytes
|
||||
uploadedAt DateTime @default(now())
|
||||
|
||||
patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)
|
||||
claim Claim? @relation(fields: [claimId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@index([patientId])
|
||||
@@index([claimId])
|
||||
}
|
||||
|
||||
15
packages/db/scripts/patch-zod-buffer.ts
Normal file
15
packages/db/scripts/patch-zod-buffer.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
const dir = path.resolve(__dirname, '../shared/schemas/objects');
|
||||
|
||||
fs.readdirSync(dir).forEach(file => {
|
||||
if (!file.endsWith('.schema.ts')) return;
|
||||
const full = path.join(dir, file);
|
||||
let content = fs.readFileSync(full, 'utf8');
|
||||
if (content.includes('z.instanceof(Buffer)') && !content.includes("import { Buffer")) {
|
||||
content = `import { Buffer } from 'buffer';\n` + content;
|
||||
fs.writeFileSync(full, content);
|
||||
console.log('Patched:', file);
|
||||
}
|
||||
});
|
||||
@@ -4,4 +4,5 @@ export * from '../shared/schemas/objects/PatientUncheckedCreateInput.schema';
|
||||
export * from '../shared/schemas/objects/UserUncheckedCreateInput.schema';
|
||||
export * from '../shared/schemas/objects/StaffUncheckedCreateInput.schema'
|
||||
export * from '../shared/schemas/objects/ClaimUncheckedCreateInput.schema'
|
||||
export * from '../shared/schemas/objects/InsuranceCredentialUncheckedCreateInput.schema'
|
||||
export * from '../shared/schemas/objects/InsuranceCredentialUncheckedCreateInput.schema'
|
||||
export * from '../shared/schemas/objects/ClaimPdfUncheckedCreateInput.schema'
|
||||
Reference in New Issue
Block a user