Compare commits
1 Commits
main
...
00e0869a13
| Author | SHA1 | Date | |
|---|---|---|---|
| 00e0869a13 |
10
.drone.yml
10
.drone.yml
@@ -42,11 +42,9 @@ steps:
|
|||||||
- name: docker build and push
|
- name: docker build and push
|
||||||
image: docker:24.0.7
|
image: docker:24.0.7
|
||||||
commands:
|
commands:
|
||||||
- dockerImageWithTag="$docker_registry$docker_repo:$DRONE_BRANCH"
|
- docker build . -t $docker_registry$docker_repo:$DRONE_BRANCH
|
||||||
- docker build . -t $dockerImageWithTag
|
|
||||||
- echo $docker_password | docker login --username $docker_username --password-stdin $docker_registry
|
- echo $docker_password | docker login --username $docker_username --password-stdin $docker_registry
|
||||||
- docker push $dockerImageWithTag
|
- docker push $docker_registry$docker_repo:$DRONE_BRANCH
|
||||||
- echo "Built and pushed $dockerImageWithTag"
|
|
||||||
environment:
|
environment:
|
||||||
docker_username:
|
docker_username:
|
||||||
from_secret: docker_username
|
from_secret: docker_username
|
||||||
@@ -62,10 +60,6 @@ steps:
|
|||||||
when:
|
when:
|
||||||
branch:
|
branch:
|
||||||
- main
|
- main
|
||||||
- production
|
|
||||||
event:
|
|
||||||
exclude:
|
|
||||||
- pull_request
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- compile (.NET)
|
- compile (.NET)
|
||||||
- test
|
- test
|
||||||
|
|||||||
14
README.md
14
README.md
@@ -8,14 +8,12 @@ Includes the backend (`src/Vegasco.Server.Api`) and the frontend (`src/Vegasco-W
|
|||||||
|
|
||||||
### Configuration
|
### Configuration
|
||||||
|
|
||||||
| Configuration | Description | Default | Required |
|
| Configuration | Description | Default | Required |
|
||||||
|------------------------------------|---------------------------------------------------------------------------------------------------------------|------------------------------------------------------------|----------|
|
|--------------------------|---------------------------------------------------------------------------------------------------------------|------------------------------------------------------------|----------|
|
||||||
| JWT:MetadataUrl | The oidc meta data url | - | true |
|
| JWT:MetadataUrl | The oidc meta data url | - | true |
|
||||||
| JWT:ValidAudience | The valid audience of the JWT token. | - | true |
|
| JWT:ValidAudience | The valid audience of the JWT token. | - | true |
|
||||||
| JWT:NameClaimType | The claim type of the user's name claim. For keycloak, using `preferred_username` is often the better choice. | http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name | false |
|
| JWT:NameClaimType | The claim type of the user's name claim. For keycloak, using `preferred_username` is often the better choice. | http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name | false |
|
||||||
| JWT:AllowHttpMetadataUrl | Whether to allow the meta data url to have http as protocol. Always true when `ASPNETCORE_ENVIRONMENT=true` | false | false |
|
| JWT:AllowHttpMetadataUrl | Whether to allow the meta data url to have http as protocol. Always true when `ASPNETCORE_ENVIRONMENT=true` | false | false |
|
||||||
| ConnectionStrings:seq | The seq http endpoint to send the logs and traces to. If not set, logs and traces will not be sent to seq. | - | false |
|
|
||||||
| ConnectionStrings:vegasco-database | The connection string to the postgres database. | - | true |
|
|
||||||
|
|
||||||
The application uses the prefix `Vegasco_` for environment variable names. The prefix is removed when the application reads the environment variables and duplicate entries are overwritten by the environment variables.
|
The application uses the prefix `Vegasco_` for environment variable names. The prefix is removed when the application reads the environment variables and duplicate entries are overwritten by the environment variables.
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
FROM node:latest AS build
|
FROM node:lts AS build
|
||||||
RUN npm install -g pnpm
|
RUN npm install -g pnpm
|
||||||
ARG CONFIGURATION=development
|
ARG CONFIGURATION=development
|
||||||
WORKDIR /usr/local/app
|
WORKDIR /usr/local/app
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ namespace Vegasco.Server.Api.Cars;
|
|||||||
public static class CreateCar
|
public static class CreateCar
|
||||||
{
|
{
|
||||||
public record Request(string Name);
|
public record Request(string Name);
|
||||||
|
|
||||||
public record Response(Guid Id, string Name);
|
public record Response(Guid Id, string Name);
|
||||||
|
|
||||||
public static RouteHandlerBuilder MapEndpoint(IEndpointRouteBuilder builder)
|
public static RouteHandlerBuilder MapEndpoint(IEndpointRouteBuilder builder)
|
||||||
@@ -43,22 +42,18 @@ public static class CreateCar
|
|||||||
ILoggerFactory loggerFactory,
|
ILoggerFactory loggerFactory,
|
||||||
CancellationToken cancellationToken)
|
CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
ILogger logger = loggerFactory.CreateLogger(typeof(CreateCar));
|
ILogger logger = loggerFactory.CreateLogger(nameof(CreateCar));
|
||||||
|
|
||||||
List<ValidationResult> failedValidations =
|
List<ValidationResult> failedValidations = await validators.ValidateAllAsync(request, cancellationToken: cancellationToken);
|
||||||
await validators.ValidateAllAsync(request, cancellationToken: cancellationToken);
|
|
||||||
if (failedValidations.Count > 0)
|
if (failedValidations.Count > 0)
|
||||||
{
|
{
|
||||||
string[] errors = failedValidations
|
|
||||||
.Where(x => !x.IsValid)
|
|
||||||
.SelectMany(x => x.Errors)
|
|
||||||
.Select(x => x.ErrorMessage)
|
|
||||||
.ToArray();
|
|
||||||
|
|
||||||
logger.LogDebug(
|
logger.LogDebug(
|
||||||
"Validation failed for request {@Request} with errors {@Errors}",
|
"Validation failed for request {@Request} with errors {@Errors}",
|
||||||
request,
|
request,
|
||||||
errors);
|
failedValidations
|
||||||
|
.Where(x => !x.IsValid)
|
||||||
|
.SelectMany(x => x.Errors)
|
||||||
|
.Select(x => x.ErrorMessage));
|
||||||
|
|
||||||
return TypedResults.BadRequest(new HttpValidationProblemDetails(failedValidations.ToCombinedDictionary()));
|
return TypedResults.BadRequest(new HttpValidationProblemDetails(failedValidations.ToCombinedDictionary()));
|
||||||
}
|
}
|
||||||
@@ -79,11 +74,18 @@ public static class CreateCar
|
|||||||
{
|
{
|
||||||
logger.LogDebug("User with ID '{UserId}' not found, creating new user", userId);
|
logger.LogDebug("User with ID '{UserId}' not found, creating new user", userId);
|
||||||
|
|
||||||
user = new User { Id = userId };
|
user = new User
|
||||||
|
{
|
||||||
|
Id = userId
|
||||||
|
};
|
||||||
await dbContext.Users.AddAsync(user, cancellationToken);
|
await dbContext.Users.AddAsync(user, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
Car car = new() { Name = request.Name.Trim(), UserId = userId };
|
Car car = new()
|
||||||
|
{
|
||||||
|
Name = request.Name.Trim(),
|
||||||
|
UserId = userId
|
||||||
|
};
|
||||||
|
|
||||||
await dbContext.Cars.AddAsync(car, cancellationToken);
|
await dbContext.Cars.AddAsync(car, cancellationToken);
|
||||||
await dbContext.SaveChangesAsync(cancellationToken);
|
await dbContext.SaveChangesAsync(cancellationToken);
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public static class DeleteCar
|
|||||||
|
|
||||||
if (rows > 1)
|
if (rows > 1)
|
||||||
{
|
{
|
||||||
ILogger logger = loggerFactory.CreateLogger(typeof(DeleteCar));
|
ILogger logger = loggerFactory.CreateLogger(nameof(DeleteCar));
|
||||||
logger.LogWarning("Deleted '{DeletedRowCount}' rows for id '{CarId}'", rows, id);
|
logger.LogWarning("Deleted '{DeletedRowCount}' rows for id '{CarId}'", rows, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,21 +44,18 @@ public static class UpdateCar
|
|||||||
ILoggerFactory loggerFactory,
|
ILoggerFactory loggerFactory,
|
||||||
CancellationToken cancellationToken)
|
CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
ILogger logger = loggerFactory.CreateLogger(typeof(UpdateCar));
|
var logger = loggerFactory.CreateLogger(nameof(UpdateCar));
|
||||||
|
|
||||||
List<ValidationResult> failedValidations = await validators.ValidateAllAsync(request, cancellationToken);
|
List<ValidationResult> failedValidations = await validators.ValidateAllAsync(request, cancellationToken);
|
||||||
if (failedValidations.Count > 0)
|
if (failedValidations.Count > 0)
|
||||||
{
|
{
|
||||||
string[] errors = failedValidations
|
|
||||||
.Where(x => !x.IsValid)
|
|
||||||
.SelectMany(x => x.Errors)
|
|
||||||
.Select(x => x.ErrorMessage)
|
|
||||||
.ToArray();
|
|
||||||
|
|
||||||
logger.LogDebug(
|
logger.LogDebug(
|
||||||
"Validation failed for request {@Request} with errors {@Errors}",
|
"Validation failed for request {@Request} with errors {@Errors}",
|
||||||
request,
|
request,
|
||||||
errors);
|
failedValidations
|
||||||
|
.Where(x => !x.IsValid)
|
||||||
|
.SelectMany(x => x.Errors)
|
||||||
|
.Select(x => x.ErrorMessage));
|
||||||
|
|
||||||
return TypedResults.BadRequest(new HttpValidationProblemDetails(failedValidations.ToCombinedDictionary()));
|
return TypedResults.BadRequest(new HttpValidationProblemDetails(failedValidations.ToCombinedDictionary()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,8 +18,6 @@ public static class DependencyInjectionExtensions
|
|||||||
/// <param name="builder"></param>
|
/// <param name="builder"></param>
|
||||||
public static void AddApiServices(this IHostApplicationBuilder builder)
|
public static void AddApiServices(this IHostApplicationBuilder builder)
|
||||||
{
|
{
|
||||||
builder.AddBuilderServices();
|
|
||||||
|
|
||||||
builder.Services
|
builder.Services
|
||||||
.AddMiscellaneousServices()
|
.AddMiscellaneousServices()
|
||||||
.AddCustomOpenApi()
|
.AddCustomOpenApi()
|
||||||
@@ -29,24 +27,6 @@ public static class DependencyInjectionExtensions
|
|||||||
builder.AddDbContext();
|
builder.AddDbContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IHostApplicationBuilder AddBuilderServices(this IHostApplicationBuilder builder)
|
|
||||||
{
|
|
||||||
string? seqHost = builder.Configuration.GetConnectionString("seq");
|
|
||||||
if (!string.IsNullOrEmpty(seqHost))
|
|
||||||
{
|
|
||||||
builder.AddSeqEndpoint("seq", o =>
|
|
||||||
{
|
|
||||||
var apiKey = builder.Configuration.GetValue<string>("seq-api-key");
|
|
||||||
if (!string.IsNullOrEmpty(apiKey))
|
|
||||||
{
|
|
||||||
o.ApiKey = apiKey;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return builder;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static IServiceCollection AddMiscellaneousServices(this IServiceCollection services)
|
private static IServiceCollection AddMiscellaneousServices(this IServiceCollection services)
|
||||||
{
|
{
|
||||||
services.AddSingleton(() =>
|
services.AddSingleton(() =>
|
||||||
|
|||||||
@@ -26,13 +26,13 @@ public static class CreateConsumption
|
|||||||
{
|
{
|
||||||
public Validator(TimeProvider timeProvider)
|
public Validator(TimeProvider timeProvider)
|
||||||
{
|
{
|
||||||
Func<DateTimeOffset> getTodayEndOfDay = () => timeProvider.GetUtcNow()
|
DateTime todayEndOfDay = timeProvider.GetUtcNow()
|
||||||
.Date
|
.Date
|
||||||
.AddDays(1)
|
.AddDays(1)
|
||||||
.AddTicks(-1);
|
.AddTicks(-1);
|
||||||
|
|
||||||
RuleFor(x => x.DateTime.ToUniversalTime())
|
RuleFor(x => x.DateTime.ToUniversalTime())
|
||||||
.LessThanOrEqualTo(_ => getTodayEndOfDay())
|
.LessThanOrEqualTo(todayEndOfDay)
|
||||||
.WithName(nameof(Request.DateTime));
|
.WithName(nameof(Request.DateTime));
|
||||||
|
|
||||||
RuleFor(x => x.Distance)
|
RuleFor(x => x.Distance)
|
||||||
@@ -53,21 +53,18 @@ public static class CreateConsumption
|
|||||||
ILoggerFactory loggerFactory,
|
ILoggerFactory loggerFactory,
|
||||||
CancellationToken cancellationToken)
|
CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
ILogger logger = loggerFactory.CreateLogger(typeof(CreateConsumption));
|
ILogger logger = loggerFactory.CreateLogger(nameof(CreateConsumption));
|
||||||
|
|
||||||
List<ValidationResult> failedValidations = await validators.ValidateAllAsync(request, cancellationToken);
|
List<ValidationResult> failedValidations = await validators.ValidateAllAsync(request, cancellationToken);
|
||||||
if (failedValidations.Count > 0)
|
if (failedValidations.Count > 0)
|
||||||
{
|
{
|
||||||
string[] errors = failedValidations
|
|
||||||
.Where(x => !x.IsValid)
|
|
||||||
.SelectMany(x => x.Errors)
|
|
||||||
.Select(x => x.ErrorMessage)
|
|
||||||
.ToArray();
|
|
||||||
|
|
||||||
logger.LogDebug(
|
logger.LogDebug(
|
||||||
"Validation failed for request {@Request} with errors {@Errors}",
|
"Validation failed for request {@Request} with errors {@Errors}",
|
||||||
request,
|
request,
|
||||||
errors);
|
failedValidations
|
||||||
|
.Where(x => !x.IsValid)
|
||||||
|
.SelectMany(x => x.Errors)
|
||||||
|
.Select(x => x.ErrorMessage));
|
||||||
|
|
||||||
return TypedResults.BadRequest(new HttpValidationProblemDetails(failedValidations.ToCombinedDictionary()));
|
return TypedResults.BadRequest(new HttpValidationProblemDetails(failedValidations.ToCombinedDictionary()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public static class DeleteConsumption
|
|||||||
|
|
||||||
if (rows > 1)
|
if (rows > 1)
|
||||||
{
|
{
|
||||||
ILogger logger = loggerFactory.CreateLogger(typeof(DeleteConsumption));
|
ILogger logger = loggerFactory.CreateLogger(nameof(DeleteConsumption));
|
||||||
logger.LogWarning("Deleted '{DeletedRowCount}' rows for id '{ConsumptionId}'", rows, id);
|
logger.LogWarning("Deleted '{DeletedRowCount}' rows for id '{ConsumptionId}'", rows, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public static class GetConsumptions
|
|||||||
ILoggerFactory loggerFactory,
|
ILoggerFactory loggerFactory,
|
||||||
CancellationToken cancellationToken)
|
CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
ILogger logger = loggerFactory.CreateLogger(typeof(GetConsumptions));
|
ILogger logger = loggerFactory.CreateLogger(nameof(GetConsumptions));
|
||||||
|
|
||||||
logger.LogTrace("Received request to get consumptions with parameters: {@Request}", request);
|
logger.LogTrace("Received request to get consumptions with parameters: {@Request}", request);
|
||||||
Activity? activity = Activity.Current;
|
Activity? activity = Activity.Current;
|
||||||
|
|||||||
@@ -26,13 +26,13 @@ public static class UpdateConsumption
|
|||||||
{
|
{
|
||||||
public Validator(TimeProvider timeProvider)
|
public Validator(TimeProvider timeProvider)
|
||||||
{
|
{
|
||||||
Func<DateTimeOffset> getTodayEndOfDay = () => timeProvider.GetUtcNow()
|
DateTime todayEndOfDay = timeProvider.GetUtcNow()
|
||||||
.Date
|
.Date
|
||||||
.AddDays(1)
|
.AddDays(1)
|
||||||
.AddTicks(-1);
|
.AddTicks(-1);
|
||||||
|
|
||||||
RuleFor(x => x.DateTime.ToUniversalTime())
|
RuleFor(x => x.DateTime.ToUniversalTime())
|
||||||
.LessThanOrEqualTo(_ => getTodayEndOfDay())
|
.LessThanOrEqualTo(todayEndOfDay)
|
||||||
.WithName(nameof(Request.DateTime));
|
.WithName(nameof(Request.DateTime));
|
||||||
|
|
||||||
RuleFor(x => x.Distance)
|
RuleFor(x => x.Distance)
|
||||||
@@ -51,21 +51,18 @@ public static class UpdateConsumption
|
|||||||
ILoggerFactory loggerFactory,
|
ILoggerFactory loggerFactory,
|
||||||
CancellationToken cancellationToken)
|
CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
ILogger logger = loggerFactory.CreateLogger(typeof(UpdateConsumption));
|
ILogger logger = loggerFactory.CreateLogger(nameof(UpdateConsumption));
|
||||||
|
|
||||||
List<ValidationResult> failedValidations = await validators.ValidateAllAsync(request, cancellationToken);
|
List<ValidationResult> failedValidations = await validators.ValidateAllAsync(request, cancellationToken);
|
||||||
if (failedValidations.Count > 0)
|
if (failedValidations.Count > 0)
|
||||||
{
|
{
|
||||||
string[] errors = failedValidations
|
|
||||||
.Where(x => !x.IsValid)
|
|
||||||
.SelectMany(x => x.Errors)
|
|
||||||
.Select(x => x.ErrorMessage)
|
|
||||||
.ToArray();
|
|
||||||
|
|
||||||
logger.LogDebug(
|
logger.LogDebug(
|
||||||
"Validation failed for request {@Request} with errors {@Errors}",
|
"Validation failed for request {@Request} with errors {@Errors}",
|
||||||
request,
|
request,
|
||||||
errors);
|
failedValidations
|
||||||
|
.Where(x => !x.IsValid)
|
||||||
|
.SelectMany(x => x.Errors)
|
||||||
|
.Select(x => x.ErrorMessage));
|
||||||
|
|
||||||
return TypedResults.BadRequest(new HttpValidationProblemDetails(failedValidations.ToCombinedDictionary()));
|
return TypedResults.BadRequest(new HttpValidationProblemDetails(failedValidations.ToCombinedDictionary()));
|
||||||
}
|
}
|
||||||
@@ -84,7 +81,6 @@ public static class UpdateConsumption
|
|||||||
|
|
||||||
logger.LogTrace("Updated consumption: {@Consumption}", consumption);
|
logger.LogTrace("Updated consumption: {@Consumption}", consumption);
|
||||||
|
|
||||||
return TypedResults.Ok(new Response(consumption.Id.Value, consumption.DateTime, consumption.Distance,
|
return TypedResults.Ok(new Response(consumption.Id.Value, consumption.DateTime, consumption.Distance, consumption.Amount, consumption.CarId.Value));
|
||||||
consumption.Amount, consumption.CarId.Value));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -41,6 +41,5 @@ public static class EndpointExtensions
|
|||||||
.RequireAuthorization(Constants.Authorization.RequireAuthenticatedUserPolicy);
|
.RequireAuthorization(Constants.Authorization.RequireAuthenticatedUserPolicy);
|
||||||
|
|
||||||
GetServerInfo.MapEndpoint(versionedApis);
|
GetServerInfo.MapEndpoint(versionedApis);
|
||||||
GetCurrentTime.MapEndpoint(versionedApis);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
using Microsoft.AspNetCore.Http.HttpResults;
|
|
||||||
|
|
||||||
namespace Vegasco.Server.Api.Info;
|
|
||||||
|
|
||||||
public static class GetCurrentTime
|
|
||||||
{
|
|
||||||
public record Response(DateTimeOffset CurrentTime);
|
|
||||||
|
|
||||||
public static RouteHandlerBuilder MapEndpoint(IEndpointRouteBuilder builder)
|
|
||||||
{
|
|
||||||
return builder
|
|
||||||
.MapGet("info/time", Endpoint)
|
|
||||||
.WithTags("Info");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Ok<Response> Endpoint(
|
|
||||||
TimeProvider timeProvider)
|
|
||||||
{
|
|
||||||
return TypedResults.Ok(new Response(timeProvider.GetUtcNow()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Vegasco.Server.Api.Info;
|
namespace Vegasco.Server.Api.Info;
|
||||||
|
|
||||||
public static class GetServerInfo
|
public class GetServerInfo
|
||||||
{
|
{
|
||||||
public record Response(
|
public record Response(
|
||||||
string FullVersion,
|
string FullVersion,
|
||||||
|
|||||||
@@ -13,24 +13,23 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Asp.Versioning.Http" Version="8.1.0" />
|
<PackageReference Include="Asp.Versioning.Http" Version="8.1.0" />
|
||||||
<PackageReference Include="Asp.Versioning.Mvc.ApiExplorer" Version="8.1.0" />
|
<PackageReference Include="Asp.Versioning.Mvc.ApiExplorer" Version="8.1.0" />
|
||||||
<PackageReference Include="Aspire.Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.5.1" />
|
<PackageReference Include="Aspire.Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.3.0" />
|
||||||
<PackageReference Include="Aspire.Seq" Version="9.5.1" />
|
|
||||||
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="12.0.0" />
|
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="12.0.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="9.0.10" />
|
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="9.0.5" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.10" />
|
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.5" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.10" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.5" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.10">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.5">
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.22.1" />
|
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.2" />
|
||||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.4" />
|
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.4" />
|
||||||
<PackageReference Include="OpenTelemetry" Version="1.13.1" />
|
<PackageReference Include="OpenTelemetry" Version="1.12.0" />
|
||||||
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.13.1" />
|
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.12.0" />
|
||||||
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.13.1" />
|
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.12.0" />
|
||||||
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.12.0" />
|
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.12.0" />
|
||||||
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.12.0" />
|
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.12.0" />
|
||||||
<PackageReference Include="Scalar.AspNetCore" Version="2.9.0" />
|
<PackageReference Include="Scalar.AspNetCore" Version="2.4.16" />
|
||||||
<PackageReference Include="StronglyTypedId" Version="1.0.0-beta08" PrivateAssets="all" ExcludeAssets="runtime" />
|
<PackageReference Include="StronglyTypedId" Version="1.0.0-beta08" PrivateAssets="all" ExcludeAssets="runtime" />
|
||||||
<PackageReference Include="StronglyTypedId.Templates" Version="1.0.0-beta08" />
|
<PackageReference Include="StronglyTypedId.Templates" Version="1.0.0-beta08" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
@@ -41,7 +40,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Update="Nerdbank.GitVersioning" Version="3.8.118" />
|
<PackageReference Update="Nerdbank.GitVersioning" Version="3.7.115" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Update="Nerdbank.GitVersioning">
|
<PackageReference Update="Nerdbank.GitVersioning">
|
||||||
<Version>3.8.118</Version>
|
<Version>3.7.115</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -14,21 +14,13 @@ if (builder.Environment.IsDevelopment())
|
|||||||
.WithPgAdmin();
|
.WithPgAdmin();
|
||||||
}
|
}
|
||||||
|
|
||||||
IResourceBuilder<SeqResource> seq = builder.AddSeq("seq")
|
|
||||||
.WithLifetime(ContainerLifetime.Persistent)
|
|
||||||
.WithDataVolume()
|
|
||||||
.WithExternalHttpEndpoints()
|
|
||||||
.WithImageTag("latest");
|
|
||||||
|
|
||||||
IResourceBuilder<PostgresDatabaseResource> postgres = postgresBuilder
|
IResourceBuilder<PostgresDatabaseResource> postgres = postgresBuilder
|
||||||
.AddDatabase(Constants.Database.Name);
|
.AddDatabase(Constants.Database.Name);
|
||||||
|
|
||||||
IResourceBuilder<ProjectResource> api = builder
|
IResourceBuilder<ProjectResource> api = builder
|
||||||
.AddProject<Projects.Vegasco_Server_Api>(Constants.Projects.Api)
|
.AddProject<Projects.Vegasco_Server_Api>(Constants.Projects.Api)
|
||||||
.WithReference(postgres)
|
.WithReference(postgres)
|
||||||
.WaitFor(postgres)
|
.WaitFor(postgres);
|
||||||
.WithReference(seq)
|
|
||||||
.WaitFor(seq);
|
|
||||||
|
|
||||||
builder
|
builder
|
||||||
.AddNpmApp("Vegasco-Web", "../Vegasco-Web")
|
.AddNpmApp("Vegasco-Web", "../Vegasco-Web")
|
||||||
|
|||||||
@@ -12,13 +12,12 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Aspire.Hosting.AppHost" Version="9.5.1" />
|
<PackageReference Include="Aspire.Hosting.AppHost" Version="9.3.0" />
|
||||||
<PackageReference Include="Aspire.Hosting.NodeJs" Version="9.5.1" />
|
<PackageReference Include="Aspire.Hosting.NodeJs" Version="9.3.1" />
|
||||||
<PackageReference Include="Aspire.Hosting.PostgreSQL" Version="9.5.1" />
|
<PackageReference Include="Aspire.Hosting.PostgreSQL" Version="9.3.0" />
|
||||||
<PackageReference Update="Nerdbank.GitVersioning">
|
<PackageReference Update="Nerdbank.GitVersioning">
|
||||||
<Version>3.8.118</Version>
|
<Version>3.7.115</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Aspire.Hosting.Seq" Version="9.5.1" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -10,15 +10,15 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<FrameworkReference Include="Microsoft.AspNetCore.App" />
|
<FrameworkReference Include="Microsoft.AspNetCore.App" />
|
||||||
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="9.10.0" />
|
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="9.5.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.ServiceDiscovery" Version="9.5.1" />
|
<PackageReference Include="Microsoft.Extensions.ServiceDiscovery" Version="9.3.0" />
|
||||||
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.13.1" />
|
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.12.0" />
|
||||||
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.13.1" />
|
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.12.0" />
|
||||||
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.12.0" />
|
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.12.0" />
|
||||||
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.12.0" />
|
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.12.0" />
|
||||||
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.12.0" />
|
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.12.0" />
|
||||||
<PackageReference Update="Nerdbank.GitVersioning">
|
<PackageReference Update="Nerdbank.GitVersioning">
|
||||||
<Version>3.8.118</Version>
|
<Version>3.7.115</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -1,32 +0,0 @@
|
|||||||
using FluentAssertions;
|
|
||||||
using FluentAssertions.Extensions;
|
|
||||||
using System.Net.Http.Json;
|
|
||||||
using Vegasco.Server.Api.Info;
|
|
||||||
|
|
||||||
namespace Vegasco.Server.Api.Tests.Integration.Info;
|
|
||||||
|
|
||||||
[Collection(SharedTestCollection.Name)]
|
|
||||||
public sealed class GetCurrentTimeTests
|
|
||||||
{
|
|
||||||
private readonly WebAppFactory _factory;
|
|
||||||
|
|
||||||
public GetCurrentTimeTests(WebAppFactory factory)
|
|
||||||
{
|
|
||||||
_factory = factory;
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task GetServerInfo_ShouldReturnServerInfo_WhenCalled()
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
|
|
||||||
// Act
|
|
||||||
using HttpResponseMessage response = await _factory.HttpClient.GetAsync("/v1/info/time");
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
response.IsSuccessStatusCode.Should().BeTrue();
|
|
||||||
GetCurrentTime.Response? timeInfo = await response.Content.ReadFromJsonAsync<GetCurrentTime.Response>();
|
|
||||||
timeInfo.Should().NotBeNull();
|
|
||||||
timeInfo.CurrentTime.Should().BeCloseTo(DateTimeOffset.UtcNow, TimeSpan.FromSeconds(10));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -10,21 +10,21 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Azure.Identity" Version="1.17.0" />
|
<PackageReference Include="Azure.Identity" Version="1.14.0" />
|
||||||
<PackageReference Include="Bogus" Version="35.6.4" />
|
<PackageReference Include="Bogus" Version="35.6.3" />
|
||||||
<PackageReference Include="coverlet.collector" Version="6.0.4">
|
<PackageReference Include="coverlet.collector" Version="6.0.4">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="FluentAssertions" Version="[7.2.0,8.0.0)" />
|
<PackageReference Include="FluentAssertions" Version="[7.2.0,8.0.0)" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="9.0.10" />
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="9.0.5" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="9.0.10" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="9.0.5" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
||||||
<PackageReference Include="Respawn" Version="6.2.1" />
|
<PackageReference Include="Respawn" Version="6.2.1" />
|
||||||
<PackageReference Include="System.Formats.Asn1" Version="9.0.10" />
|
<PackageReference Include="System.Formats.Asn1" Version="9.0.5" />
|
||||||
<PackageReference Include="Testcontainers.PostgreSql" Version="4.7.0" />
|
<PackageReference Include="Testcontainers.PostgreSql" Version="4.5.0" />
|
||||||
<PackageReference Include="xunit" Version="2.9.3" />
|
<PackageReference Include="xunit" Version="2.9.3" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
|
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.1">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Update="Nerdbank.GitVersioning" Version="3.8.118" />
|
<PackageReference Update="Nerdbank.GitVersioning" Version="3.7.115" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -14,12 +14,12 @@
|
|||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="FluentAssertions" Version="8.7.1" />
|
<PackageReference Include="FluentAssertions" Version="8.3.0" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="9.0.10" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="9.0.5" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
||||||
<PackageReference Include="NSubstitute" Version="5.3.0" />
|
<PackageReference Include="NSubstitute" Version="5.3.0" />
|
||||||
<PackageReference Include="xunit" Version="2.9.3" />
|
<PackageReference Include="xunit" Version="2.9.3" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
|
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.1">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Update="Nerdbank.GitVersioning" Version="3.8.118" />
|
<PackageReference Update="Nerdbank.GitVersioning" Version="3.7.115" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
Reference in New Issue
Block a user