/
softailor
/
gridient
Обзор
Документация
Войти
/
softailor
/
gridient
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
backend/Gridient.Infrastructure.Authorization.Local/Controllers/GroupsController.cs
53 строки
2 KB
Jenkins
Auto add
18 фев 2026, 10:19
18 фев 2026, 10:19
1e6c4f8
Код
Авторство
О чём код?
using Gridient.Core.Controllers; using Gridient.Infrastructure.Authorization.Local.Features.Groups.Commands; using Gridient.Infrastructure.Authorization.Local.Features.Groups.Queries; using Gridient.Infrastructure.Authorization.Local.Models; using MediatR; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; namespace Gridient.Infrastructure.Authorization.Local.Controllers { [Route("api/groups")] [ApiController] [Authorize] public class GroupsController(IMediator mediator) : ListsBaseController { private readonly IMediator _mediator = mediator; [HttpGet] public async Task<IActionResult> GetGroups(CancellationToken cancellationToken) { var query = new GetGroupsQuery(); var result = await _mediator.Send(query, cancellationToken); return Ok(result); } [HttpPost] public async Task<IActionResult> CreateGroup([FromBody] Group group, CancellationToken cancellationToken) { var command = new CreateGroupCommand(group); var result = await _mediator.Send(command, cancellationToken); return Ok(result); } [HttpPut] [Route("{groupId:int}")] public async Task<IActionResult> UpdateGroup(int groupId, [FromBody] Group group, CancellationToken cancellationToken) { group.Id = groupId; var command = new UpdateGroupCommand(group); await _mediator.Send(command, cancellationToken); return Ok(); } [HttpDelete] [Route("{groupId:int}")] public async Task<IActionResult> DeleteGroup(int groupId, CancellationToken cancellationToken) { var command = new DeleteGroupCommand(groupId); await _mediator.Send(command, cancellationToken); return Ok(); } } }