From ad0622f9533fe523b83e93d1151deb296f292f34 Mon Sep 17 00:00:00 2001 From: kurt-mcrae Date: Sat, 30 Nov 2024 19:58:58 +1100 Subject: [PATCH] Lint --- backend/Services/IPriceService.cs | 4 +++- backend/Services/ISuburbBoundariesService.cs | 1 - backend/Services/StationWithPricesService.cs | 2 -- backend/Services/SuburbBoundariesService.cs | 12 +++--------- backend/TODO.md | 9 ++++++++- backend/backend.csproj | 8 ++++---- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/backend/Services/IPriceService.cs b/backend/Services/IPriceService.cs index 426d3879..fad6b324 100644 --- a/backend/Services/IPriceService.cs +++ b/backend/Services/IPriceService.cs @@ -6,7 +6,9 @@ namespace backend.Services; public interface IPriceService { Task> GetAllCurrentPrices(int pageNumber, int pageSize); - Task> GetCurrentPricesByStationCode(int stationCode, string? fuelType, int pageNumber, int pageSize); + + Task> GetCurrentPricesByStationCode(int stationCode, string? fuelType, int pageNumber, + int pageSize); Task> GetCurrentPricesByFuelType(string fuelType, int pageNumber, int pageSize); diff --git a/backend/Services/ISuburbBoundariesService.cs b/backend/Services/ISuburbBoundariesService.cs index bd80f39b..4a6f3b3f 100644 --- a/backend/Services/ISuburbBoundariesService.cs +++ b/backend/Services/ISuburbBoundariesService.cs @@ -1,4 +1,3 @@ -using System.Text.Json; using backend.Models.SuburbBoundariesApi; namespace backend.Services; diff --git a/backend/Services/StationWithPricesService.cs b/backend/Services/StationWithPricesService.cs index ab7e6d62..77552ac6 100644 --- a/backend/Services/StationWithPricesService.cs +++ b/backend/Services/StationWithPricesService.cs @@ -46,13 +46,11 @@ public class StationWithPricesService : IStationWithPricesService { var prices = await _priceService.GetCurrentPricesByStationCode(station.Code, fuelType, 1, int.MaxValue); if (prices.TotalCount > 0) - { return new StationWithPrices { Station = station, Prices = prices.Data.ToList() }; - } return null; //return null if no prices found }); diff --git a/backend/Services/SuburbBoundariesService.cs b/backend/Services/SuburbBoundariesService.cs index b6c1c049..8f74f1f9 100644 --- a/backend/Services/SuburbBoundariesService.cs +++ b/backend/Services/SuburbBoundariesService.cs @@ -8,9 +8,9 @@ namespace backend.Services; public class SuburbBoundariesService : ISuburbBoundariesService { - private readonly ILogger _logger; private readonly IDbConnectionFactory _dbConnectionFactory; private readonly IHttpClientFactory _httpClientFactory; + private readonly ILogger _logger; private readonly SuburbBoundaryApiConfig _suburbBoundaryApiConfig; public SuburbBoundariesService(IDbConnectionFactory dbConnectionFactory, IHttpClientFactory httpClientFactory, @@ -156,15 +156,9 @@ public class SuburbBoundariesService : ISuburbBoundariesService } //insert or update remaining items in batches - if (suburbBoundariesToInsert.Count > 0) - { - await db.InsertAllAsync(suburbBoundariesToInsert); - } + if (suburbBoundariesToInsert.Count > 0) await db.InsertAllAsync(suburbBoundariesToInsert); - if (suburbBoundariesToUpdate.Count > 0) - { - await db.UpdateAllAsync(suburbBoundariesToUpdate); - } + if (suburbBoundariesToUpdate.Count > 0) await db.UpdateAllAsync(suburbBoundariesToUpdate); } catch (Exception e) { diff --git a/backend/TODO.md b/backend/TODO.md index 7b927254..51c6fd4d 100644 --- a/backend/TODO.md +++ b/backend/TODO.md @@ -1,7 +1,14 @@ # TODO for this application + ## Fluent Validator + - Use it + ## Create a PaginationOptions class + - Need this to abstract a heap of the boilerplate in the method signatures in services + ## Implement sorting and filtering on the API -- When paginating results, the sorting and filtering on the client side does not apply across pages, obviously. We should rectify this \ No newline at end of file + +- When paginating results, the sorting and filtering on the client side does not apply across pages, obviously. We + should rectify this \ No newline at end of file diff --git a/backend/backend.csproj b/backend/backend.csproj index 28319241..2c4d1f21 100644 --- a/backend/backend.csproj +++ b/backend/backend.csproj @@ -8,11 +8,11 @@ - + - - - + + +