diff --git a/backend/src/features/fuel-logs/data/fuel-logs.repository.ts b/backend/src/features/fuel-logs/data/fuel-logs.repository.ts index 934936e..f2b9501 100644 --- a/backend/src/features/fuel-logs/data/fuel-logs.repository.ts +++ b/backend/src/features/fuel-logs/data/fuel-logs.repository.ts @@ -293,7 +293,7 @@ export class FuelLogsRepository { data.notes ?? null ]; const res = await this.pool.query(query, values); - return res.rows[0] ? this.mapRow(res.rows[0]) : null; + return res.rows[0] ?? null; } async findByVehicleIdEnhanced(vehicleId: string): Promise { @@ -301,7 +301,7 @@ export class FuelLogsRepository { `SELECT * FROM fuel_logs WHERE vehicle_id = $1 ORDER BY date_time DESC NULLS LAST, date DESC NULLS LAST, created_at DESC`, [vehicleId] ); - return res.rows.map(row => this.mapRow(row)); + return res.rows; } async findByUserIdEnhanced(userId: string): Promise { @@ -309,12 +309,12 @@ export class FuelLogsRepository { `SELECT * FROM fuel_logs WHERE user_id = $1 ORDER BY date_time DESC NULLS LAST, date DESC NULLS LAST, created_at DESC`, [userId] ); - return res.rows.map(row => this.mapRow(row)); + return res.rows; } async findByIdEnhanced(id: string): Promise { const res = await this.pool.query(`SELECT * FROM fuel_logs WHERE id = $1`, [id]); - return res.rows[0] ? this.mapRow(res.rows[0]) : null; + return res.rows[0] ?? null; } async getPreviousLogByOdometer(vehicleId: string, odometerReading: number): Promise { @@ -322,7 +322,7 @@ export class FuelLogsRepository { `SELECT * FROM fuel_logs WHERE vehicle_id = $1 AND odometer IS NOT NULL AND odometer < $2 ORDER BY odometer DESC LIMIT 1`, [vehicleId, odometerReading] ); - return res.rows[0] ? this.mapRow(res.rows[0]) : null; + return res.rows[0] ?? null; } async getLatestLogForVehicle(vehicleId: string): Promise { @@ -330,7 +330,7 @@ export class FuelLogsRepository { `SELECT * FROM fuel_logs WHERE vehicle_id = $1 ORDER BY date_time DESC NULLS LAST, date DESC NULLS LAST, created_at DESC LIMIT 1`, [vehicleId] ); - return res.rows[0] ? this.mapRow(res.rows[0]) : null; + return res.rows[0] ?? null; } async updateEnhanced(id: string, data: { @@ -416,6 +416,6 @@ export class FuelLogsRepository { return null; } - return this.mapRow(result.rows[0]); + return result.rows[0]; } }