diff --git a/apps/api/prisma/migrations/20231110181854_extra_fields_emergency_vehicle/migration.sql b/apps/api/prisma/migrations/20231110181854_extra_fields_emergency_vehicle/migration.sql new file mode 100644 index 000000000..2306dac02 --- /dev/null +++ b/apps/api/prisma/migrations/20231110181854_extra_fields_emergency_vehicle/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE "EmergencyVehicleValue" ADD COLUMN "extraFields" JSONB; diff --git a/apps/api/prisma/schema.prisma b/apps/api/prisma/schema.prisma index 94eddfac1..8b0ee67fe 100644 --- a/apps/api/prisma/schema.prisma +++ b/apps/api/prisma/schema.prisma @@ -788,6 +788,7 @@ model EmergencyVehicleValue { valueId String departments DepartmentValue[] divisions DivisionValue[] + extraFields Json? Officers Officer[] @relation("activeEmergencyVehicle_leo") EmsFdDeputies EmsFdDeputy[] @relation("activeEmergencyVehicle_emsfd") diff --git a/apps/api/src/controllers/admin/values/import-values-controller.ts b/apps/api/src/controllers/admin/values/import-values-controller.ts index 566ab5a37..6621a5215 100644 --- a/apps/api/src/controllers/admin/values/import-values-controller.ts +++ b/apps/api/src/controllers/admin/values/import-values-controller.ts @@ -506,6 +506,7 @@ export const typeHandlers = { ...makePrismaData(ValueType.EMERGENCY_VEHICLE, { value: item.value, isDisabled: item.isDisabled, + extraFields: item.extraFields || undefined, }), include: valueInclude, }); diff --git a/packages/schemas/src/admin/values/import.ts b/packages/schemas/src/admin/values/import.ts index b45c13de6..6f266df31 100644 --- a/packages/schemas/src/admin/values/import.ts +++ b/packages/schemas/src/admin/values/import.ts @@ -156,6 +156,7 @@ export const CALL_TYPE_ARR = z.array(CALL_TYPE_SCHEMA).min(1); export const EMERGENCY_VEHICLE_SCHEMA = BASE_VALUE_SCHEMA.extend({ departments: z.array(z.string()).min(1), divisions: z.array(z.string()).nullish(), + extraFields: z.any().nullish(), }); export const EMERGENCY_VEHICLE_ARR = z.array(EMERGENCY_VEHICLE_SCHEMA).min(1);