Merge branch 'feature/operations-service-orchestration' into development
This commit is contained in:
commit
f6bd0f2a49
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +1,4 @@
|
|||||||
.tasks/
|
.tasks/
|
||||||
.agile/
|
.agile/
|
||||||
|
**/bin/
|
||||||
|
**/obj/
|
||||||
|
|||||||
10
Directory.Build.props
Normal file
10
Directory.Build.props
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<Project>
|
||||||
|
<PropertyGroup>
|
||||||
|
<Authors>AgileWebs</Authors>
|
||||||
|
<Company>AgileWebs</Company>
|
||||||
|
<RepositoryType>git</RepositoryType>
|
||||||
|
<RepositoryUrl>http://192.168.68.156:3000/AgileWebs/operations-service</RepositoryUrl>
|
||||||
|
<PackageProjectUrl>http://192.168.68.156:3000/AgileWebs/operations-service</PackageProjectUrl>
|
||||||
|
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
7
Operations.Service.slnx
Normal file
7
Operations.Service.slnx
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<Solution>
|
||||||
|
<Folder Name="/src/">
|
||||||
|
<Project Path="src/Operations.Service.Application/Operations.Service.Application.csproj" />
|
||||||
|
<Project Path="src/Operations.Service.Contracts/Operations.Service.Contracts.csproj" />
|
||||||
|
<Project Path="src/Operations.Service.Grpc/Operations.Service.Grpc.csproj" />
|
||||||
|
</Folder>
|
||||||
|
</Solution>
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Operations.Service.Contracts\Operations.Service.Contracts.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
using Operations.Service.Contracts.Contracts;
|
||||||
|
using Operations.Service.Contracts.Responses;
|
||||||
|
|
||||||
|
namespace Operations.Service.Application.Ports;
|
||||||
|
|
||||||
|
public sealed class DefaultOperationsConfigReadPort : IOperationsConfigReadPort
|
||||||
|
{
|
||||||
|
public Task<GetOperationsConfigResponse> ReadConfigAsync(string locationId, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var flags = new[]
|
||||||
|
{
|
||||||
|
new FeatureFlagStateContract("kitchen.dispatch.enabled", true),
|
||||||
|
new FeatureFlagStateContract("orders.priority.escalation", false)
|
||||||
|
};
|
||||||
|
|
||||||
|
return Task.FromResult(new GetOperationsConfigResponse("v1", flags));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
using Operations.Service.Contracts.Responses;
|
||||||
|
|
||||||
|
namespace Operations.Service.Application.Ports;
|
||||||
|
|
||||||
|
public interface IOperationsConfigReadPort
|
||||||
|
{
|
||||||
|
Task<GetOperationsConfigResponse> ReadConfigAsync(string locationId, CancellationToken cancellationToken);
|
||||||
|
}
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
using Operations.Service.Application.Ports;
|
||||||
|
using Operations.Service.Contracts.Requests;
|
||||||
|
using Operations.Service.Contracts.Responses;
|
||||||
|
|
||||||
|
namespace Operations.Service.Application.UseCases;
|
||||||
|
|
||||||
|
public sealed class GetOperationsConfigUseCase(IOperationsConfigReadPort readPort) : IGetOperationsConfigUseCase
|
||||||
|
{
|
||||||
|
public Task<GetOperationsConfigResponse> HandleAsync(GetOperationsConfigRequest request, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
return readPort.ReadConfigAsync(request.LocationId, cancellationToken);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
using Operations.Service.Contracts.Requests;
|
||||||
|
using Operations.Service.Contracts.Responses;
|
||||||
|
|
||||||
|
namespace Operations.Service.Application.UseCases;
|
||||||
|
|
||||||
|
public interface IGetOperationsConfigUseCase
|
||||||
|
{
|
||||||
|
Task<GetOperationsConfigResponse> HandleAsync(GetOperationsConfigRequest request, CancellationToken cancellationToken);
|
||||||
|
}
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
namespace Operations.Service.Contracts.Contracts;
|
||||||
|
|
||||||
|
public sealed record FeatureFlagStateContract(string Key, bool Enabled);
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
namespace Operations.Service.Contracts.Requests;
|
||||||
|
|
||||||
|
public sealed record GetOperationsConfigRequest(string LocationId);
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
using Operations.Service.Contracts.Contracts;
|
||||||
|
|
||||||
|
namespace Operations.Service.Contracts.Responses;
|
||||||
|
|
||||||
|
public sealed record GetOperationsConfigResponse(string Version, IReadOnlyCollection<FeatureFlagStateContract> FeatureFlags);
|
||||||
13
src/Operations.Service.Grpc/Operations.Service.Grpc.csproj
Normal file
13
src/Operations.Service.Grpc/Operations.Service.Grpc.csproj
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Operations.Service.Application\Operations.Service.Application.csproj" />
|
||||||
|
<ProjectReference Include="..\Operations.Service.Contracts\Operations.Service.Contracts.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
17
src/Operations.Service.Grpc/Program.cs
Normal file
17
src/Operations.Service.Grpc/Program.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using Operations.Service.Application.Ports;
|
||||||
|
using Operations.Service.Application.UseCases;
|
||||||
|
using Operations.Service.Contracts.Requests;
|
||||||
|
|
||||||
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
builder.Services.AddSingleton<IOperationsConfigReadPort, DefaultOperationsConfigReadPort>();
|
||||||
|
builder.Services.AddSingleton<IGetOperationsConfigUseCase, GetOperationsConfigUseCase>();
|
||||||
|
|
||||||
|
var app = builder.Build();
|
||||||
|
|
||||||
|
app.MapGet("/internal/operations/config", async (string locationId, IGetOperationsConfigUseCase useCase, CancellationToken ct) =>
|
||||||
|
{
|
||||||
|
var request = new GetOperationsConfigRequest(locationId);
|
||||||
|
return Results.Ok(await useCase.HandleAsync(request, ct));
|
||||||
|
});
|
||||||
|
|
||||||
|
app.Run();
|
||||||
23
src/Operations.Service.Grpc/Properties/launchSettings.json
Normal file
23
src/Operations.Service.Grpc/Properties/launchSettings.json
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json.schemastore.org/launchsettings.json",
|
||||||
|
"profiles": {
|
||||||
|
"http": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"dotnetRunMessages": true,
|
||||||
|
"launchBrowser": true,
|
||||||
|
"applicationUrl": "http://localhost:0",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"https": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"dotnetRunMessages": true,
|
||||||
|
"launchBrowser": true,
|
||||||
|
"applicationUrl": "https://localhost:0;http://localhost:0",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
8
src/Operations.Service.Grpc/appsettings.Development.json
Normal file
8
src/Operations.Service.Grpc/appsettings.Development.json
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft.AspNetCore": "Warning"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
9
src/Operations.Service.Grpc/appsettings.json
Normal file
9
src/Operations.Service.Grpc/appsettings.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft.AspNetCore": "Warning"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"AllowedHosts": "*"
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user