diff --git a/app/data/gasBillRepo.test.ts b/app/data/gasBillRepo.test.ts index 327d9e27..c75576de 100644 --- a/app/data/gasBillRepo.test.ts +++ b/app/data/gasBillRepo.test.ts @@ -18,14 +18,14 @@ describe("gasBillRepo", () => { const mockGasBill = 150; // Example gas bill amount (prisma.gasBills.findFirstOrThrow as jest.Mock).mockResolvedValueOnce({ - kwh_cost_pence: mockGasBill, + kwhCostPence: mockGasBill, }); const result = await gasBillRepo.getGasBillByITL3(itl); expect(result).toBe(mockGasBill); expect(prisma.gasBills.findFirstOrThrow).toHaveBeenCalledWith({ where: { itl1: { startsWith: itl.substring(0, 3) } }, - select: { kwh_cost_pence: true }, + select: { kwhCostPence: true }, }); }); diff --git a/app/data/gasBillRepo.ts b/app/data/gasBillRepo.ts index 21125ce3..2805d1c3 100644 --- a/app/data/gasBillRepo.ts +++ b/app/data/gasBillRepo.ts @@ -2,14 +2,14 @@ import prisma from "./db"; const getGasBillByITL3 = async (itl: string): Promise => { try { - const { kwh_cost_pence } = await prisma.gasBills.findFirstOrThrow({ + const { kwhCostPence } = await prisma.gasBills.findFirstOrThrow({ where: { itl1: { startsWith: itl.substring(0, 3) }, }, - select: { kwh_cost_pence: true }, + select: { kwhCostPence: true }, }); - return kwh_cost_pence; + return kwhCostPence; } catch (error) { throw Error(`Data error: Unable to find gas_bills_2020 for itl3 ${itl}`); } diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 4bbe3324..3b8d4669 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -92,7 +92,7 @@ model GasBills { id Int @id region String @map("region") @db.VarChar itl1 String @db.VarChar - kwh_cost_pence Float + kwhCostPence Float @map("kwh_cost_pence") @@map("gas_bills") }