mirror of
https://github.com/Govor-team/Govor.git
synced 2026-07-21 19:54:55 +00:00
4f3f4ec066
Moved service implementations and interfaces from Govor.API and Govor.Core to new Govor.Application and Govor.Contracts projects. Updated namespaces and references throughout the solution. Added custom exception classes for authentication and invite services. Adjusted dependency injection and project references to use the new structure. This refactor improves separation of concerns and prepares the codebase for better maintainability and scalability.
33 lines
742 B
C#
33 lines
742 B
C#
using Govor.API.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();
|
|
|
|
return Ok(new
|
|
{
|
|
groupId = group.Id,
|
|
name = group.Name,
|
|
isChannel = group.IsChannel
|
|
});
|
|
}
|
|
}
|