feat: много запланированного

- клонирование коллекции
- добавление паблик-коллекций
- регенерация паблик-ссылок
This commit is contained in:
2026-10-07 02:45:37 +04:00
parent c1b052e2c7
commit 274e60a433
30 changed files with 719 additions and 112 deletions
@@ -1,11 +1,13 @@
using MediatR;
using MemeVault.Application.Common;
using MemeVault.Domain.Exceptions;
using MemeVault.Domain.Repositories;
namespace MemeVault.Application.Commands.UpdateCollection;
public sealed class UpdateCollectionCommandHandler(
ICollectionRepository collections,
IBotUserRepository users,
IUnitOfWork unitOfWork)
: IRequestHandler<UpdateCollectionCommand, bool>
{
@@ -17,6 +19,10 @@ public sealed class UpdateCollectionCommandHandler(
if (collection is null || collection.GetRole(request.RequestingTelegramId) is null)
return false;
var user = await users.GetByTelegramIdAsync(request.RequestingTelegramId, ct);
if (user?.InboxCollectionId == collection.Id)
throw new DomainException("Cannot rename the Inbox collection.");
collection.Rename(request.Name, request.RequestingTelegramId);
await unitOfWork.SaveChangesAsync(ct);
return true;