Files
Govor/Govor.API/Controllers/InviteController.cs
T
2025-06-18 16:55:19 +07:00

34 lines
828 B
C#

using Govor.Core.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace Govor.API.Controllers;
[ApiController]
[Route("invite")]
public class InviteController : ControllerBase
{
private readonly IGroupService _groupService;
public InviteController(IGroupService groupService)
{
_groupService = groupService;
}
[HttpGet("{code}")]
[Authorize]
public IActionResult JoinGroup(string code)
{
var group = _groupService.GetGroupByInvite(code);
if (group == null) return NotFound();
// Вернуть инфу, которая откроется в MAUI-клиенте
return Ok(new
{
groupId = group.Id,
name = group.Name,
isChannel = group.IsChannel
});
}
}