feat: много запланированного
- клонирование коллекции - добавление паблик-коллекций - регенерация паблик-ссылок
This commit is contained in:
@@ -4,6 +4,9 @@ using MemeVault.Application.Commands.CreateCollection;
|
||||
using MemeVault.Application.Commands.CreateCollectionInvite;
|
||||
using MemeVault.Application.Commands.DeleteCollection;
|
||||
using MemeVault.Application.Commands.RevokeCollectionInvite;
|
||||
using MemeVault.Application.Commands.CloneCollection;
|
||||
using MemeVault.Application.Commands.RegenerateShareLink;
|
||||
using MemeVault.Application.Commands.JoinPublicCollection;
|
||||
using MemeVault.Application.Commands.SetCollectionInbox;
|
||||
using MemeVault.Application.Commands.SetCollectionNsfw;
|
||||
using MemeVault.Application.Commands.ShareCollection;
|
||||
@@ -111,6 +114,32 @@ public sealed class CollectionsController(IMediator mediator, CurrentUser curren
|
||||
return ok ? NoContent() : NotFound();
|
||||
}
|
||||
|
||||
// POST /api/collections/{id}/clone
|
||||
[HttpPost("{id:guid}/clone")]
|
||||
[ProducesResponseType(typeof(object), StatusCodes.Status201Created)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
public async Task<IActionResult> Clone(Guid id, CancellationToken ct)
|
||||
{
|
||||
var newId = await mediator.Send(
|
||||
new CloneCollectionCommand(id, currentUser.TelegramId), ct);
|
||||
|
||||
return newId is null
|
||||
? NotFound()
|
||||
: CreatedAtAction(nameof(GetAll), new { id = newId }, new { id = newId });
|
||||
}
|
||||
|
||||
// POST /api/collections/{id}/join
|
||||
[HttpPost("{id:guid}/join")]
|
||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
public async Task<IActionResult> Join(Guid id, CancellationToken ct)
|
||||
{
|
||||
var ok = await mediator.Send(
|
||||
new JoinPublicCollectionCommand(id, currentUser.TelegramId), ct);
|
||||
|
||||
return ok ? NoContent() : NotFound();
|
||||
}
|
||||
|
||||
// PUT /api/collections/{id}/inbox
|
||||
[HttpPut("{id:guid}/inbox")]
|
||||
public async Task<IActionResult> SetInbox(Guid id, CancellationToken ct)
|
||||
@@ -133,6 +162,18 @@ public sealed class CollectionsController(IMediator mediator, CurrentUser curren
|
||||
return ok ? NoContent() : NotFound();
|
||||
}
|
||||
|
||||
// POST /api/collections/{id}/share-link/regenerate
|
||||
[HttpPost("{id:guid}/share-link/regenerate")]
|
||||
[ProducesResponseType(typeof(object), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
public async Task<IActionResult> RegenerateShareLink(Guid id, CancellationToken ct)
|
||||
{
|
||||
var token = await mediator.Send(
|
||||
new RegenerateShareLinkCommand(id, currentUser.TelegramId), ct);
|
||||
|
||||
return token is null ? NotFound() : Ok(new { shareToken = token });
|
||||
}
|
||||
|
||||
// PUT /api/collections/{id}/visibility
|
||||
[HttpPut("{id:guid}/visibility")]
|
||||
public async Task<IActionResult> SetVisibility(
|
||||
|
||||
Reference in New Issue
Block a user