This commit is contained in:
kurt-mcrae committed 2024-11-30 19:58:58 +11:00
1 parent 3ba183db33
commit ad0622f953
6 files changed
+18 -18

No files matched your search

+3 -1
View File
@@ -6,7 +6,9 @@ namespace backend.Services;
public interface IPriceService
{
Task<Pagination<Price>> GetAllCurrentPrices(int pageNumber, int pageSize);
Task<Pagination<Price>> GetCurrentPricesByStationCode(int stationCode, string? fuelType, int pageNumber, int pageSize);
Task<Pagination<Price>> GetCurrentPricesByStationCode(int stationCode, string? fuelType, int pageNumber,
int pageSize);
Task<Pagination<Price>> GetCurrentPricesByFuelType(string fuelType, int pageNumber, int pageSize);
@@ -1,4 +1,3 @@
using System.Text.Json;
using backend.Models.SuburbBoundariesApi;
namespace backend.Services;
@@ -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
});
+3 -9
View File
@@ -8,9 +8,9 @@ namespace backend.Services;
public class SuburbBoundariesService : ISuburbBoundariesService
{
private readonly ILogger<SuburbBoundariesService> _logger;
private readonly IDbConnectionFactory _dbConnectionFactory;
private readonly IHttpClientFactory _httpClientFactory;
private readonly ILogger<SuburbBoundariesService> _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)
{
+8 -1
View File
@@ -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
- When paginating results, the sorting and filtering on the client side does not apply across pages, obviously. We
should rectify this
+4 -4
View File
@@ -8,11 +8,11 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Hangfire.AspNetCore" Version="1.8.16" />
<PackageReference Include="Hangfire.AspNetCore" Version="1.8.16"/>
<PackageReference Include="Hangfire.PostgreSql" Version="1.20.10"/>
<PackageReference Include="ServiceStack.OrmLite.PostgreSQL" Version="8.5.2" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="7.1.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="7.1.0" />
<PackageReference Include="ServiceStack.OrmLite.PostgreSQL" Version="8.5.2"/>
<PackageReference Include="Swashbuckle.AspNetCore" Version="7.1.0"/>
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="7.1.0"/>
</ItemGroup>
</Project>