Files
KArtSell.Aegis/docs/Design/kbx-foundation-v52-fe-operational-navigation-screen-anatomy/backend/Modules/OMS/Lookups/Items/ResolveByCodeEndpoint.cs
T
kjh2064 c41e5063b7 chore: remove kbx-foundation-v36 reference (superseded by v4 implementation)
Removed entire kbx-foundation-v36 directory as it's been replaced by
the new KBX Foundation v4 patterns implemented in this session:
- Registry-driven screen definitions
- Density-aware UI adapter components
- Feature module templates (ShadowRun, Models)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-08-12 01:39:58 +09:00

26 lines
921 B
C#

using Dapper;
using FastEndpoints;
using Npgsql;
namespace Modules.OMS.Lookups.Items;
public sealed class ResolveByCodeEndpoint(NpgsqlDataSource dataSource) : EndpointWithoutRequest
{
public override void Configure()
{
Get("/api/lookups/items/by-code/{code}");
Permissions("erp.item.read");
}
public override async Task HandleAsync(CancellationToken ct)
{
var code = Route<string>("code");
await using var connection = await dataSource.OpenConnectionAsync(ct);
var item = await connection.QuerySingleOrDefaultAsync(new CommandDefinition(@"
select id, code, name as DisplayName, case when is_active then '사용' else '중지' end as Status
from catalog.items where code=@Code and is_active=true;", new { Code = code }, cancellationToken: ct));
if (item is null) { await Send.NotFoundAsync(ct); return; }
await Send.OkAsync(item, ct);
}
}