Compare commits

..

2 Commits

Author SHA1 Message Date
b41d5c5d33 Ensure correct sorting and thus also correct liter per 100km calculation
All checks were successful
continuous-integration/drone/push Build is passing
2025-06-24 20:35:49 +02:00
4b377ce9f4 Fix resource name to be a valid Aspire resource name 2025-06-24 20:35:26 +02:00
7 changed files with 12 additions and 10 deletions

View File

@@ -14,7 +14,7 @@
"options": {
"env": {
"PORT": "44200",
"services__Vegasco-Server-Api__https__0": "https://localhost:7098",
"services__Api__https__0": "https://localhost:7098",
"NODE_ENV": "development"
}
},

View File

@@ -16,7 +16,7 @@ Once the server is running, open your browser and navigate to `http://localhost:
Because the solution utilizes Aspire which injects endpoint references for the API as environment variables, this application uses a proxy to access the API. The proxy is configured in the `proxy.config.js` file which is used in the `serve` section of the `angular.json` file. This makes the dev server provide a proxy when serving the application.
The environment variables for the API endpoint are named `services__Vegasco-Server-Api__https__0` and `services__Vegasco-Server-Api__http__0` for the https and the http endpoints respectively. If the https endpoint is not configured, the http endpoint is used. At least one of them has to be configured.
The environment variables for the API endpoint are named `services__Api__https__0` and `services__Api__http__0` for the https and the http endpoints respectively. If the https endpoint is not configured, the http endpoint is used. At least one of them has to be configured.
To allow the dev proxy to accept otherwise untrusted server certificates, set `NODE_ENV` to `development`. Otherwise the dev proxy rejects untrusted certificates.

View File

@@ -1,8 +1,8 @@
module.exports = {
"/api": {
target:
process.env["services__Vegasco-Server-Api__https__0"] ||
process.env["services__Vegasco-Server-Api__http__0"],
process.env["services__Api__https__0"] ||
process.env["services__Api__http__0"],
secure: process.env["NODE_ENV"] !== "development",
pathRewrite: {
"^/api": "",

View File

@@ -73,7 +73,7 @@ export class EntriesComponent implements OnInit {
const entries = this.consumptionClient.getAll()
.pipe(
takeUntilDestroyed(),
map(response => response.consumptions),
map(response => response.consumptions.sort((a, b) => b.dateTime.localeCompare(a.dateTime))),
catchError((error) => this.handleGetEntriesError(error))
);

View File

@@ -2,7 +2,7 @@ server {
listen 80;
location ~ ^/api/(.*) {
proxy_pass ${services__Vegasco_Server_Api__https__0}/$1;
proxy_pass ${services__Api__https__0}/$1;
}
location / {

View File

@@ -52,10 +52,9 @@ public static class GetConsumptions
CancellationToken cancellationToken)
{
Dictionary<CarId, List<Consumption>> consumptionsByCar = await dbContext.Consumptions
.OrderByDescending(x => x.DateTime)
.Include(x => x.Car)
.GroupBy(x => x.CarId)
.ToDictionaryAsync(x => x.Key, x => x.ToList(), cancellationToken);
.ToDictionaryAsync(x => x.Key, x => x.OrderByDescending(x => x.DateTime).ToList(), cancellationToken);
List<ResponseDto> responses = [];
@@ -85,7 +84,10 @@ public static class GetConsumptions
}
}
ApiResponse apiResponse = new() { Consumptions = responses };
ApiResponse apiResponse = new()
{
Consumptions = responses
};
return TypedResults.Ok(apiResponse);
}
}

View File

@@ -4,7 +4,7 @@ public static class Constants
{
public static class Projects
{
public const string Api = "Vegasco_Server_Api";
public const string Api = "Api";
}
public static class Database