Merge branch 'feature/kitchen-service-orchestration' into development

This commit is contained in:
José René White Enciso 2026-02-25 18:18:16 -06:00
commit cb0f238e4b
17 changed files with 169 additions and 0 deletions

2
.gitignore vendored
View File

@ -1,2 +1,4 @@
.tasks/ .tasks/
.agile/ .agile/
**/bin/
**/obj/

10
Directory.Build.props Normal file
View File

@ -0,0 +1,10 @@
<Project>
<PropertyGroup>
<Authors>AgileWebs</Authors>
<Company>AgileWebs</Company>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>http://192.168.68.156:3000/AgileWebs/kitchen-service</RepositoryUrl>
<PackageProjectUrl>http://192.168.68.156:3000/AgileWebs/kitchen-service</PackageProjectUrl>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
</PropertyGroup>
</Project>

7
Kitchen.Service.slnx Normal file
View File

@ -0,0 +1,7 @@
<Solution>
<Folder Name="/src/">
<Project Path="src/Kitchen.Service.Application/Kitchen.Service.Application.csproj" />
<Project Path="src/Kitchen.Service.Contracts/Kitchen.Service.Contracts.csproj" />
<Project Path="src/Kitchen.Service.Grpc/Kitchen.Service.Grpc.csproj" />
</Folder>
</Solution>

View File

@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Kitchen.Service.Contracts\Kitchen.Service.Contracts.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,18 @@
using Kitchen.Service.Contracts.Contracts;
using Kitchen.Service.Contracts.Responses;
namespace Kitchen.Service.Application.Ports;
public sealed class DefaultKitchenQueueReadPort : IKitchenQueueReadPort
{
public Task<GetKitchenQueueResponse> ReadQueueAsync(string queueName, int limit, CancellationToken cancellationToken)
{
var items = new[]
{
new KitchenQueueItemContract("WK-1001", "PrepareOrder", 3, "Queued"),
new KitchenQueueItemContract("WK-1002", "AssembleTray", 2, "Queued")
}.Take(Math.Max(limit, 0)).ToArray();
return Task.FromResult(new GetKitchenQueueResponse(items));
}
}

View File

@ -0,0 +1,8 @@
using Kitchen.Service.Contracts.Responses;
namespace Kitchen.Service.Application.Ports;
public interface IKitchenQueueReadPort
{
Task<GetKitchenQueueResponse> ReadQueueAsync(string queueName, int limit, CancellationToken cancellationToken);
}

View File

@ -0,0 +1,13 @@
using Kitchen.Service.Application.Ports;
using Kitchen.Service.Contracts.Requests;
using Kitchen.Service.Contracts.Responses;
namespace Kitchen.Service.Application.UseCases;
public sealed class GetKitchenQueueUseCase(IKitchenQueueReadPort readPort) : IGetKitchenQueueUseCase
{
public Task<GetKitchenQueueResponse> HandleAsync(GetKitchenQueueRequest request, CancellationToken cancellationToken)
{
return readPort.ReadQueueAsync(request.QueueName, request.Limit, cancellationToken);
}
}

View File

@ -0,0 +1,9 @@
using Kitchen.Service.Contracts.Requests;
using Kitchen.Service.Contracts.Responses;
namespace Kitchen.Service.Application.UseCases;
public interface IGetKitchenQueueUseCase
{
Task<GetKitchenQueueResponse> HandleAsync(GetKitchenQueueRequest request, CancellationToken cancellationToken);
}

View File

@ -0,0 +1,3 @@
namespace Kitchen.Service.Contracts.Contracts;
public sealed record KitchenQueueItemContract(string WorkItemId, string WorkType, int Priority, string State);

View File

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,3 @@
namespace Kitchen.Service.Contracts.Requests;
public sealed record GetKitchenQueueRequest(string QueueName, int Limit);

View File

@ -0,0 +1,5 @@
using Kitchen.Service.Contracts.Contracts;
namespace Kitchen.Service.Contracts.Responses;
public sealed record GetKitchenQueueResponse(IReadOnlyCollection<KitchenQueueItemContract> Items);

View 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="..\Kitchen.Service.Application\Kitchen.Service.Application.csproj" />
<ProjectReference Include="..\Kitchen.Service.Contracts\Kitchen.Service.Contracts.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,17 @@
using Kitchen.Service.Application.Ports;
using Kitchen.Service.Application.UseCases;
using Kitchen.Service.Contracts.Requests;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSingleton<IKitchenQueueReadPort, DefaultKitchenQueueReadPort>();
builder.Services.AddSingleton<IGetKitchenQueueUseCase, GetKitchenQueueUseCase>();
var app = builder.Build();
app.MapGet("/internal/kitchen/queue", async (string queueName, int? limit, IGetKitchenQueueUseCase useCase, CancellationToken ct) =>
{
var request = new GetKitchenQueueRequest(queueName, limit ?? 20);
return Results.Ok(await useCase.HandleAsync(request, ct));
});
app.Run();

View 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"
}
}
}
}

View File

@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}

View File

@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}