types updated
This commit is contained in:
22
packages/db/types/appointment-types.ts
Normal file
22
packages/db/types/appointment-types.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { AppointmentUncheckedCreateInputObjectSchema } from "@repo/db/usedSchemas";
|
||||
import {z} from "zod";
|
||||
|
||||
export type Appointment = z.infer<typeof AppointmentUncheckedCreateInputObjectSchema>;
|
||||
|
||||
export const insertAppointmentSchema = (
|
||||
AppointmentUncheckedCreateInputObjectSchema as unknown as z.ZodObject<any>
|
||||
).omit({
|
||||
id: true,
|
||||
createdAt: true,
|
||||
});
|
||||
export type InsertAppointment = z.infer<typeof insertAppointmentSchema>;
|
||||
|
||||
export const updateAppointmentSchema = (
|
||||
AppointmentUncheckedCreateInputObjectSchema as unknown as z.ZodObject<any>
|
||||
)
|
||||
.omit({
|
||||
id: true,
|
||||
createdAt: true,
|
||||
})
|
||||
.partial();
|
||||
export type UpdateAppointment = z.infer<typeof updateAppointmentSchema>;
|
||||
59
packages/db/types/claim-types.ts
Normal file
59
packages/db/types/claim-types.ts
Normal file
@@ -0,0 +1,59 @@
|
||||
import { ClaimStatusSchema, ClaimUncheckedCreateInputObjectSchema } from "@repo/db/usedSchemas";
|
||||
import {z} from "zod";
|
||||
import { Decimal } from "decimal.js";
|
||||
import { Staff } from "@repo/db/types";
|
||||
|
||||
export const insertClaimSchema = (
|
||||
ClaimUncheckedCreateInputObjectSchema as unknown as z.ZodObject<any>
|
||||
).omit({
|
||||
id: true,
|
||||
createdAt: true,
|
||||
updatedAt: true,
|
||||
});
|
||||
export type InsertClaim = z.infer<typeof insertClaimSchema>;
|
||||
|
||||
export const updateClaimSchema = (
|
||||
ClaimUncheckedCreateInputObjectSchema as unknown as z.ZodObject<any>
|
||||
)
|
||||
.omit({
|
||||
id: true,
|
||||
createdAt: true,
|
||||
updatedAt: true,
|
||||
})
|
||||
.partial();
|
||||
export type UpdateClaim = z.infer<typeof updateClaimSchema>;
|
||||
|
||||
export type Claim = z.infer<typeof ClaimUncheckedCreateInputObjectSchema>;
|
||||
export type ClaimStatus = z.infer<typeof ClaimStatusSchema>;
|
||||
|
||||
|
||||
|
||||
//used in claim-form
|
||||
export interface InputServiceLine {
|
||||
procedureCode: string;
|
||||
procedureDate: string; // YYYY-MM-DD
|
||||
oralCavityArea?: string;
|
||||
toothNumber?: string;
|
||||
toothSurface?: string;
|
||||
totalBilled: Decimal;
|
||||
totalPaid?: Decimal;
|
||||
totalAdjusted?: Decimal;
|
||||
}
|
||||
|
||||
// Claim model with embedded service lines
|
||||
export type ClaimWithServiceLines = Claim & {
|
||||
serviceLines: {
|
||||
id: number;
|
||||
claimId: number;
|
||||
procedureCode: string;
|
||||
procedureDate: Date;
|
||||
oralCavityArea: string | null;
|
||||
toothNumber: string | null;
|
||||
toothSurface: string | null;
|
||||
totalBilled: Decimal;
|
||||
totalPaid: Decimal;
|
||||
totalAdjusted: Decimal;
|
||||
status: string;
|
||||
}[];
|
||||
staff?: Staff | null;
|
||||
};
|
||||
@@ -1,2 +1,8 @@
|
||||
|
||||
export * from "./appointment-types";
|
||||
export * from "./claim-types";
|
||||
export * from "./insurance-types";
|
||||
export * from "./patient-types";;
|
||||
export * from "./payment-types";
|
||||
export * from "./pdf-types";
|
||||
export * from "./staff-types";
|
||||
export * from "./user-types";
|
||||
14
packages/db/types/insurance-types.ts
Normal file
14
packages/db/types/insurance-types.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { InsuranceCredentialUncheckedCreateInputObjectSchema } from "@repo/db/usedSchemas";
|
||||
import {z} from "zod";
|
||||
|
||||
export type InsuranceCredential = z.infer<
|
||||
typeof InsuranceCredentialUncheckedCreateInputObjectSchema
|
||||
>;
|
||||
|
||||
export const insertInsuranceCredentialSchema = (
|
||||
InsuranceCredentialUncheckedCreateInputObjectSchema as unknown as z.ZodObject<any>
|
||||
).omit({ id: true });
|
||||
|
||||
export type InsertInsuranceCredential = z.infer<
|
||||
typeof insertInsuranceCredentialSchema
|
||||
>;
|
||||
24
packages/db/types/patient-types.ts
Normal file
24
packages/db/types/patient-types.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { PatientUncheckedCreateInputObjectSchema } from "@repo/db/usedSchemas";
|
||||
import {z} from "zod";
|
||||
|
||||
export type Patient = z.infer<typeof PatientUncheckedCreateInputObjectSchema>;
|
||||
|
||||
export const insertPatientSchema = (
|
||||
PatientUncheckedCreateInputObjectSchema as unknown as z.ZodObject<any>
|
||||
).omit({
|
||||
id: true,
|
||||
createdAt: true,
|
||||
});
|
||||
export type InsertPatient = z.infer<typeof insertPatientSchema>;
|
||||
|
||||
export const updatePatientSchema = (
|
||||
PatientUncheckedCreateInputObjectSchema as unknown as z.ZodObject<any>
|
||||
)
|
||||
.omit({
|
||||
id: true,
|
||||
createdAt: true,
|
||||
userId: true,
|
||||
})
|
||||
.partial();
|
||||
|
||||
export type UpdatePatient = z.infer<typeof updatePatientSchema>;
|
||||
@@ -91,38 +91,18 @@ export type PaymentWithExtras = Prisma.PaymentGetPayload<{
|
||||
paymentMethod: string;
|
||||
};
|
||||
|
||||
// Claim model with embedded service lines
|
||||
export type Claim = z.infer<typeof ClaimUncheckedCreateInputObjectSchema>;
|
||||
export type ClaimStatus = z.infer<typeof ClaimStatusSchema>;
|
||||
|
||||
export type Staff = z.infer<typeof StaffUncheckedCreateInputObjectSchema>;
|
||||
|
||||
export type ClaimWithServiceLines = Claim & {
|
||||
serviceLines: {
|
||||
id: number;
|
||||
claimId: number;
|
||||
procedureCode: string;
|
||||
procedureDate: Date;
|
||||
oralCavityArea: string | null;
|
||||
toothNumber: string | null;
|
||||
toothSurface: string | null;
|
||||
billedAmount: number;
|
||||
status: string;
|
||||
}[];
|
||||
staff: Staff | null;
|
||||
};
|
||||
|
||||
export type NewTransactionPayload = {
|
||||
paymentId: number;
|
||||
amount: number;
|
||||
method: PaymentMethod;
|
||||
payerName?: string;
|
||||
notes?: string;
|
||||
receivedDate: Date;
|
||||
status: PaymentStatus;
|
||||
serviceLineTransactions: {
|
||||
serviceLineId: number;
|
||||
transactionId?: string;
|
||||
paidAmount: number;
|
||||
adjustedAmount: number;
|
||||
adjustedAmount?: number;
|
||||
method: PaymentMethod;
|
||||
receivedDate: Date;
|
||||
payerName?: string;
|
||||
notes?: string;
|
||||
}[];
|
||||
};
|
||||
|
||||
12
packages/db/types/pdf-types.ts
Normal file
12
packages/db/types/pdf-types.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { PdfCategorySchema, PdfFileUncheckedCreateInputObjectSchema, PdfGroupUncheckedCreateInputObjectSchema } from "@repo/db/usedSchemas";
|
||||
import {z} from "zod";
|
||||
|
||||
export type PdfGroup = z.infer<typeof PdfGroupUncheckedCreateInputObjectSchema>;
|
||||
export type PdfFile = z.infer<typeof PdfFileUncheckedCreateInputObjectSchema>;
|
||||
export type PdfCategory = z.infer<typeof PdfCategorySchema>;
|
||||
|
||||
export interface ClaimPdfMetadata {
|
||||
id: number;
|
||||
filename: string;
|
||||
uploadedAt: Date;
|
||||
}
|
||||
4
packages/db/types/staff-types.ts
Normal file
4
packages/db/types/staff-types.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import { StaffUncheckedCreateInputObjectSchema } from "@repo/db/usedSchemas";
|
||||
import {z} from "zod";
|
||||
|
||||
export type Staff = z.infer<typeof StaffUncheckedCreateInputObjectSchema>;
|
||||
36
packages/db/types/user-types.ts
Normal file
36
packages/db/types/user-types.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
|
||||
import { UserUncheckedCreateInputObjectSchema } from "@repo/db/usedSchemas";
|
||||
import {z} from "zod";
|
||||
|
||||
export type User = z.infer<typeof UserUncheckedCreateInputObjectSchema>;
|
||||
|
||||
export const insertUserSchema = (
|
||||
UserUncheckedCreateInputObjectSchema as unknown as z.ZodObject<any>
|
||||
).pick({
|
||||
username: true,
|
||||
password: true,
|
||||
});
|
||||
|
||||
export const loginSchema = (insertUserSchema as unknown as z.ZodObject<any>).extend({
|
||||
rememberMe: z.boolean().optional(),
|
||||
});
|
||||
|
||||
export const registerSchema = (insertUserSchema as unknown as z.ZodObject<any>)
|
||||
.extend({
|
||||
confirmPassword: z.string().min(6, {
|
||||
message: "Password must be at least 6 characters long",
|
||||
}),
|
||||
agreeTerms: z.literal(true, {
|
||||
errorMap: () => ({
|
||||
message: "You must agree to the terms and conditions",
|
||||
}),
|
||||
}),
|
||||
})
|
||||
.refine((data: any) => data.password === data.confirmPassword, {
|
||||
message: "Passwords don't match",
|
||||
path: ["confirmPassword"],
|
||||
});
|
||||
|
||||
export type InsertUser = z.infer<typeof insertUserSchema>;
|
||||
export type LoginFormValues = z.infer<typeof loginSchema>;
|
||||
export type RegisterFormValues = z.infer<typeof registerSchema>;
|
||||
Reference in New Issue
Block a user