Add forwarding, friend controls, and benefits

Add message forwarding and reply lookup, friend removal and blocking endpoints, and database-backed Govor+ privileges with customizable profile tags. Include migrations, integration tests, and updated API and operations documentation.
This commit is contained in:
Artemy
2026-10-31 18:29:40 +07:00
parent a3401ceedf
commit 632ac04b56
78 changed files with 5284 additions and 720 deletions
@@ -0,0 +1,28 @@
using AutoMapper;
using Govor.Application.Infrastructure.Extensions;
using Govor.Application.Messages;
using Govor.Contracts.Responses;
using Govor.Domain;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
namespace Govor.API.Controllers;
/// <summary>Loads a reply target outside the current history page without exposing another conversation.</summary>
[ApiController]
[Authorize]
[Route("api/messages")]
public sealed class MessageLookupController(GovorDbContext db, ICurrentUserService currentUser, IMapper mapper) : ControllerBase
{
[HttpGet("{messageId:guid}")]
public async Task<IActionResult> Get(Guid messageId)
{
var message = await db.Messages.AsNoTracking().Include(m => m.MediaAttachments).ThenInclude(m => m.MediaFile)
.Include(m => m.Reactions).Include(m => m.MessageViews).AsSplitQuery()
.SingleOrDefaultAsync(m => m.Id == messageId);
if (message is null || !await db.HasChatAccessAsync(currentUser.GetCurrentUserId(), message.RecipientId, message.RecipientType))
return NotFound();
return Ok(mapper.Map<MessageResponse>(message));
}
}