using Application.Abstractions.Data; using Application.Abstractions.Messaging; using SharedKernel.Results; using Domain.Entities.Donations.ValueObject; namespace Application.Features.Api.DonationRemote.IgnoreAlert; internal sealed class Handler(IAppDbContext db) : ICommandHandler { public async Task Handle(Command request, CancellationToken ct) { var alert = await db.DonationAlert.FindAsync([request.AlertID], ct); if (alert is null) { return Result.Failure(Error.NotFound("DonationAlert.NotFound", "알림을 찾을 수 없습니다.")); } if (alert.Status == AlertStatus.Playing) { return Result.Failure(Error.Conflict("DonationAlert.PlayingCannotBeIgnored", "재생 중인 알림은 무시할 수 없습니다.")); } alert.MarkIgnored(); await db.SaveChangesAsync(ct); return Result.Success(); } }