Files
vegasco/src/Vegasco.Server.Api/Endpoints/EndpointExtensions.cs
ThompsonNye a1999bfe41
All checks were successful
continuous-integration/drone/push Build is passing
Rename WebApi project to Vegasco.Server.Api
And update all references including comments etc.
2025-06-12 18:23:09 +02:00

37 lines
1.1 KiB
C#

using Asp.Versioning.Builder;
using Asp.Versioning.Conventions;
using Vegasco.Server.Api.Cars;
using Vegasco.Server.Api.Common;
using Vegasco.Server.Api.Consumptions;
using Vegasco.Server.Api.Info;
namespace Vegasco.Server.Api.Endpoints;
public static class EndpointExtensions
{
public static void MapEndpoints(this IEndpointRouteBuilder builder)
{
ApiVersionSet apiVersionSet = builder.NewApiVersionSet()
.HasApiVersion(1.0)
.Build();
RouteGroupBuilder versionedApis = builder.MapGroup("/v{apiVersion:apiVersion}")
.WithApiVersionSet(apiVersionSet)
.RequireAuthorization(Constants.Authorization.RequireAuthenticatedUserPolicy);
GetCar.MapEndpoint(versionedApis);
GetCars.MapEndpoint(versionedApis);
CreateCar.MapEndpoint(versionedApis);
UpdateCar.MapEndpoint(versionedApis);
DeleteCar.MapEndpoint(versionedApis);
GetConsumptions.MapEndpoint(versionedApis);
GetConsumption.MapEndpoint(versionedApis);
CreateConsumption.MapEndpoint(versionedApis);
UpdateConsumption.MapEndpoint(versionedApis);
DeleteConsumption.MapEndpoint(versionedApis);
GetServerInfo.MapEndpoint(versionedApis);
}
}