Compare commits
2 Commits
5e084ab0a8
...
b41d5c5d33
| Author | SHA1 | Date | |
|---|---|---|---|
| b41d5c5d33 | |||
| 4b377ce9f4 |
2
src/Vegasco-Web/.vscode/tasks.json
vendored
2
src/Vegasco-Web/.vscode/tasks.json
vendored
@@ -14,7 +14,7 @@
|
|||||||
"options": {
|
"options": {
|
||||||
"env": {
|
"env": {
|
||||||
"PORT": "44200",
|
"PORT": "44200",
|
||||||
"services__Vegasco-Server-Api__https__0": "https://localhost:7098",
|
"services__Api__https__0": "https://localhost:7098",
|
||||||
"NODE_ENV": "development"
|
"NODE_ENV": "development"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -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.
|
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.
|
To allow the dev proxy to accept otherwise untrusted server certificates, set `NODE_ENV` to `development`. Otherwise the dev proxy rejects untrusted certificates.
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
"/api": {
|
"/api": {
|
||||||
target:
|
target:
|
||||||
process.env["services__Vegasco-Server-Api__https__0"] ||
|
process.env["services__Api__https__0"] ||
|
||||||
process.env["services__Vegasco-Server-Api__http__0"],
|
process.env["services__Api__http__0"],
|
||||||
secure: process.env["NODE_ENV"] !== "development",
|
secure: process.env["NODE_ENV"] !== "development",
|
||||||
pathRewrite: {
|
pathRewrite: {
|
||||||
"^/api": "",
|
"^/api": "",
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ export class EntriesComponent implements OnInit {
|
|||||||
const entries = this.consumptionClient.getAll()
|
const entries = this.consumptionClient.getAll()
|
||||||
.pipe(
|
.pipe(
|
||||||
takeUntilDestroyed(),
|
takeUntilDestroyed(),
|
||||||
map(response => response.consumptions),
|
map(response => response.consumptions.sort((a, b) => b.dateTime.localeCompare(a.dateTime))),
|
||||||
catchError((error) => this.handleGetEntriesError(error))
|
catchError((error) => this.handleGetEntriesError(error))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ server {
|
|||||||
listen 80;
|
listen 80;
|
||||||
|
|
||||||
location ~ ^/api/(.*) {
|
location ~ ^/api/(.*) {
|
||||||
proxy_pass ${services__Vegasco_Server_Api__https__0}/$1;
|
proxy_pass ${services__Api__https__0}/$1;
|
||||||
}
|
}
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
|
|||||||
@@ -52,10 +52,9 @@ public static class GetConsumptions
|
|||||||
CancellationToken cancellationToken)
|
CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
Dictionary<CarId, List<Consumption>> consumptionsByCar = await dbContext.Consumptions
|
Dictionary<CarId, List<Consumption>> consumptionsByCar = await dbContext.Consumptions
|
||||||
.OrderByDescending(x => x.DateTime)
|
|
||||||
.Include(x => x.Car)
|
.Include(x => x.Car)
|
||||||
.GroupBy(x => x.CarId)
|
.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 = [];
|
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);
|
return TypedResults.Ok(apiResponse);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,7 +4,7 @@ public static class Constants
|
|||||||
{
|
{
|
||||||
public static class Projects
|
public static class Projects
|
||||||
{
|
{
|
||||||
public const string Api = "Vegasco_Server_Api";
|
public const string Api = "Api";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Database
|
public static class Database
|
||||||
|
|||||||
Reference in New Issue
Block a user