/
softailor
/
gridient
Обзор
Документация
Войти
/
softailor
/
gridient
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
backend/Gridient.Core/Controllers/ViewsController.cs
52 строки
2 KB
Jenkins
Auto add
18 фев 2026, 10:19
18 фев 2026, 10:19
1e6c4f8
Код
Авторство
О чём код?
using Gridient.Core.Features.Views.Commands; using Gridient.Core.Features.Views.Queries; using Gridient.Core.Models; using MediatR; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; namespace Gridient.Core.Controllers { [ApiController] [Authorize] public class ViewsController(IMediator mediator) : ListsBaseController { private readonly IMediator _mediator = mediator; [HttpGet] [Route("api/lists/{listId:int}/views")] public async Task<IActionResult> GetViews(int listId, CancellationToken cancellationToken) { var query = new GetViewsQuery(CurrentUserLogin, listId); var result = await _mediator.Send(query, cancellationToken); return Ok(result); } [HttpPost] [Route("api/lists/{listId:int}/views")] public async Task<ActionResult> CreateView(int listId, [FromBody] CreateViewRequest createViewRequest, CancellationToken cancellationToken) { var command = new CreateViewCommand(listId, createViewRequest); await _mediator.Send(command, cancellationToken); return Ok(); } [HttpPost] [Route("api/lists/{listId:int}/views/{viewId:int}")] public async Task<ActionResult> UpdateView(int listId, int viewId, [FromBody] UpdateViewRequest updateViewRequest, CancellationToken cancellationToken) { var command = new UpdateViewCommand(listId, viewId, updateViewRequest); await _mediator.Send(command, cancellationToken); return Ok(); } [HttpDelete] [Route("api/lists/{listId:int}/views/{viewId:int}")] public async Task<IActionResult> Delete(int listId, int viewId, CancellationToken cancellationToken) { var command = new DeleteViewCommand(listId, viewId); await _mediator.Send(command, cancellationToken); return Ok(); } } }