c41e5063b7
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>
24 lines
1.2 KiB
C#
24 lines
1.2 KiB
C#
using FastEndpoints;
|
|
using Kbx.Shared.Runtime;
|
|
|
|
namespace Kbx.Modules.Common.Runtime.Notifications;
|
|
|
|
public sealed class Request { public int Limit { get; init; } = 30; }
|
|
public sealed class Endpoint(KbxNotificationRepository repository) : Endpoint<Request, IReadOnlyList<KbxUserNotificationDto>>
|
|
{
|
|
public override void Configure() { Get("/api/kbx/runtime/notifications"); Permissions("common.runtime.read"); }
|
|
public override async Task HandleAsync(Request req, CancellationToken ct)
|
|
=> await Send.OkAsync(await repository.GetRecentAsync(RuntimeIdentity.TenantId(User), RuntimeIdentity.UserId(User), req.Limit, ct), ct);
|
|
}
|
|
|
|
public sealed class MarkReadRequest { public Guid Id { get; init; } }
|
|
public sealed class MarkReadEndpoint(KbxNotificationRepository repository) : Endpoint<MarkReadRequest>
|
|
{
|
|
public override void Configure() { Post("/api/kbx/runtime/notifications/{Id}/read"); Permissions("common.runtime.read"); }
|
|
public override async Task HandleAsync(MarkReadRequest req, CancellationToken ct)
|
|
{
|
|
await repository.MarkReadAsync(RuntimeIdentity.TenantId(User), RuntimeIdentity.UserId(User), req.Id, ct);
|
|
await Send.NoContentAsync(ct);
|
|
}
|
|
}
|