feat: collections controller, healthcheck

This commit is contained in:
2026-09-28 02:18:57 +04:00
parent 5ca59a6ad8
commit 5238bfd103
11 changed files with 273 additions and 1 deletions
@@ -0,0 +1,22 @@
using MediatR;
using MemeVault.Application.Common;
using MemeVault.Domain.Repositories;
namespace MemeVault.Application.Commands.UpdateCollection;
public sealed class UpdateCollectionCommandHandler(
ICollectionRepository collections,
IUnitOfWork unitOfWork)
: IRequestHandler<UpdateCollectionCommand, bool>
{
public async Task<bool> Handle(UpdateCollectionCommand request, CancellationToken ct)
{
var collection = await collections.GetByIdAsync(request.CollectionId, ct);
if (collection is null || collection.OwnerTelegramId != request.RequestingTelegramId)
return false;
collection.Rename(request.Name, request.RequestingTelegramId);
await unitOfWork.SaveChangesAsync(ct);
return true;
}
}