Add primitive groups and required channel

Adds server-side group and channel management, private invitations, member moderation, avatar handling, and required-channel configuration. This change also introduces SignalR group profile/member notifications, updates registration to atomically join required channels, and adds EF migration and test coverage for group membership, permissions, and invitation expiry rules.
This commit is contained in:
Artemy
2026-10-04 10:35:07 +07:00
parent fed8f518ee
commit 2e9d7e625e
48 changed files with 3593 additions and 167 deletions
@@ -1,4 +1,5 @@
using Govor.API.Common.Extensions;
using Govor.API.Hubs.Infrastructure;
using Govor.Application.Authentication;
using Govor.Application.Users.UserSessions;
using Govor.Contracts.Requests;
@@ -17,17 +18,20 @@ public class AuthController : Controller
private IInvitesService _invitesService;
private IAccountService _accountService;
private ILogger<AuthController> _logger;
private readonly IChatNotificationService _notifier;
public AuthController(
IAccountService accountService,
IInvitesService invitesService,
IUserSessionOpener userSessionOpener,
ILogger<AuthController> logger)
ILogger<AuthController> logger,
IChatNotificationService notifier)
{
_userSession = userSessionOpener;
_accountService = accountService;
_invitesService = invitesService;
_logger = logger;
_notifier = notifier;
}
[HttpPost("register")] // api/auth/register
@@ -38,7 +42,12 @@ public class AuthController : Controller
var result = await _invitesService.ValidateAsync(request.InviteLink)
.BindAsync(invite => _accountService.RegistrationAsync(request.Name, request.Password, invite))
.TapAsync(user => _logger.LogInformation("User {Username} ({Id}) registered successfully", user.Username, user.Id))
.BindAsync(user => _userSession.OpenSessionAsync(user, request.DeviceInfo));
.BindAsync(async user =>
{
// Registration has committed the required-channel membership at this point.
await _notifier.NotifyUserJoinedGroupsAsync(user.Id);
return await _userSession.OpenSessionAsync(user, request.DeviceInfo);
});
if (result.IsFailure)
{
@@ -74,4 +83,4 @@ public class AuthController : Controller
return result.ToActionResult();
}
}
}