feat: appointment type inference, procedure codes on cards, claim attachment fixes
- Add appointment type categories matching insurance claim form (recall, filling, pedo, dentures, implant, endo, crown, perio, extraction, ortho, consultation, emergency, other) - Auto-infer appointment type from CDT codes with priority rules (endo > implant > crown > ...) - typeLocked flag prevents auto-overwrite when user manually sets type - Show appointment type label and procedure codes on schedule cards - Background sync on /day route retroactively fixes stale appointment types - Fix PUT /api/claims/:id to save claimFiles (previously silently dropped) - Auto-link AppointmentFile records to ClaimFile when claim is created or updated - Fix D5750 (denture reline) CDT range to map correctly to dentures category - Fix typeLocked Zod rejection in appointment update route Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,23 +1,22 @@
|
||||
import * as z from 'zod';
|
||||
import type { Prisma } from '../../../generated/prisma';
|
||||
import { PaymentStatusSchema } from '../enums/PaymentStatus.schema';
|
||||
import { ClaimCreateNestedOneWithoutPaymentInputObjectSchema as ClaimCreateNestedOneWithoutPaymentInputObjectSchema } from './ClaimCreateNestedOneWithoutPaymentInput.schema';
|
||||
import { PatientCreateNestedOneWithoutPaymentInputObjectSchema as PatientCreateNestedOneWithoutPaymentInputObjectSchema } from './PatientCreateNestedOneWithoutPaymentInput.schema';
|
||||
import { UserCreateNestedOneWithoutUpdatedPaymentsInputObjectSchema as UserCreateNestedOneWithoutUpdatedPaymentsInputObjectSchema } from './UserCreateNestedOneWithoutUpdatedPaymentsInput.schema';
|
||||
import { NpiProviderCreateNestedOneWithoutPaymentsInputObjectSchema as NpiProviderCreateNestedOneWithoutPaymentsInputObjectSchema } from './NpiProviderCreateNestedOneWithoutPaymentsInput.schema';
|
||||
import { ServiceLineCreateNestedManyWithoutPaymentInputObjectSchema as ServiceLineCreateNestedManyWithoutPaymentInputObjectSchema } from './ServiceLineCreateNestedManyWithoutPaymentInput.schema';
|
||||
import { Prisma } from '../../../generated/prisma';
|
||||
import Decimal from 'decimal.js';
|
||||
import { PaymentStatusSchema } from '../enums/PaymentStatus.schema';
|
||||
import { ClaimCreateNestedOneWithoutPaymentInputObjectSchema as ClaimCreateNestedOneWithoutPaymentInputObjectSchema } from './ClaimCreateNestedOneWithoutPaymentInput.schema';
|
||||
import { PatientCreateNestedOneWithoutPaymentInputObjectSchema as PatientCreateNestedOneWithoutPaymentInputObjectSchema } from './PatientCreateNestedOneWithoutPaymentInput.schema';
|
||||
import { UserCreateNestedOneWithoutUpdatedPaymentsInputObjectSchema as UserCreateNestedOneWithoutUpdatedPaymentsInputObjectSchema } from './UserCreateNestedOneWithoutUpdatedPaymentsInput.schema';
|
||||
import { NpiProviderCreateNestedOneWithoutPaymentsInputObjectSchema as NpiProviderCreateNestedOneWithoutPaymentsInputObjectSchema } from './NpiProviderCreateNestedOneWithoutPaymentsInput.schema';
|
||||
import { ServiceLineCreateNestedManyWithoutPaymentInputObjectSchema as ServiceLineCreateNestedManyWithoutPaymentInputObjectSchema } from './ServiceLineCreateNestedManyWithoutPaymentInput.schema';
|
||||
import { CommissionBatchItemCreateNestedManyWithoutPaymentInputObjectSchema as CommissionBatchItemCreateNestedManyWithoutPaymentInputObjectSchema } from './CommissionBatchItemCreateNestedManyWithoutPaymentInput.schema'
|
||||
|
||||
import { DecimalJSLikeSchema, isValidDecimalInput } from '../../helpers/decimal-helpers';
|
||||
|
||||
import Decimal from "decimal.js";
|
||||
const makeSchema = () => z.object({
|
||||
userId: z.number().int(),
|
||||
totalBilled: z.union([
|
||||
z.number(),
|
||||
z.string(),
|
||||
z.instanceof(Decimal),
|
||||
z.instanceof(Decimal),
|
||||
z.instanceof(Prisma.Decimal),
|
||||
DecimalJSLikeSchema,
|
||||
]).refine((v) => isValidDecimalInput(v), {
|
||||
message: "Field 'totalBilled' must be a Decimal",
|
||||
@@ -26,7 +25,7 @@ const makeSchema = () => z.object({
|
||||
z.number(),
|
||||
z.string(),
|
||||
z.instanceof(Decimal),
|
||||
z.instanceof(Decimal),
|
||||
z.instanceof(Prisma.Decimal),
|
||||
DecimalJSLikeSchema,
|
||||
]).refine((v) => isValidDecimalInput(v), {
|
||||
message: "Field 'totalPaid' must be a Decimal",
|
||||
@@ -35,7 +34,7 @@ const makeSchema = () => z.object({
|
||||
z.number(),
|
||||
z.string(),
|
||||
z.instanceof(Decimal),
|
||||
z.instanceof(Decimal),
|
||||
z.instanceof(Prisma.Decimal),
|
||||
DecimalJSLikeSchema,
|
||||
]).refine((v) => isValidDecimalInput(v), {
|
||||
message: "Field 'totalAdjusted' must be a Decimal",
|
||||
@@ -44,7 +43,7 @@ const makeSchema = () => z.object({
|
||||
z.number(),
|
||||
z.string(),
|
||||
z.instanceof(Decimal),
|
||||
z.instanceof(Decimal),
|
||||
z.instanceof(Prisma.Decimal),
|
||||
DecimalJSLikeSchema,
|
||||
]).refine((v) => isValidDecimalInput(v), {
|
||||
message: "Field 'totalDue' must be a Decimal",
|
||||
@@ -53,7 +52,7 @@ const makeSchema = () => z.object({
|
||||
z.number(),
|
||||
z.string(),
|
||||
z.instanceof(Decimal),
|
||||
z.instanceof(Decimal),
|
||||
z.instanceof(Prisma.Decimal),
|
||||
DecimalJSLikeSchema,
|
||||
]).refine((v) => isValidDecimalInput(v), {
|
||||
message: "Field 'mhPaidAmount' must be a Decimal",
|
||||
@@ -62,7 +61,7 @@ const makeSchema = () => z.object({
|
||||
z.number(),
|
||||
z.string(),
|
||||
z.instanceof(Decimal),
|
||||
z.instanceof(Decimal),
|
||||
z.instanceof(Prisma.Decimal),
|
||||
DecimalJSLikeSchema,
|
||||
]).refine((v) => isValidDecimalInput(v), {
|
||||
message: "Field 'copayment' must be a Decimal",
|
||||
@@ -71,7 +70,7 @@ const makeSchema = () => z.object({
|
||||
z.number(),
|
||||
z.string(),
|
||||
z.instanceof(Decimal),
|
||||
z.instanceof(Decimal),
|
||||
z.instanceof(Prisma.Decimal),
|
||||
DecimalJSLikeSchema,
|
||||
]).refine((v) => isValidDecimalInput(v), {
|
||||
message: "Field 'adjustment' must be a Decimal",
|
||||
|
||||
Reference in New Issue
Block a user