/
softailor
/
gridient
Обзор
Документация
Войти
/
softailor
/
gridient
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
backend/Gridient.Core/Controllers/FieldsController.cs
70 строк
3 KB
Jenkins
Auto add
18 фев 2026, 10:19
18 фев 2026, 10:19
1e6c4f8
Код
Авторство
О чём код?
using Gridient.Core.Features.Fields.Commands; using Gridient.Core.Features.Fields.Queries; using Gridient.Core.Models; using MediatR; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; namespace Gridient.Core.Controllers { [ApiController] [Authorize] public class FieldsController(IMediator mediator) : ListsBaseController { private readonly IMediator _mediator = mediator; [HttpGet] [Route("api/lists/{listId:int}/fields")] public async Task<IActionResult> GetFields(int listId, CancellationToken cancellationToken) { var query = new GetFieldsQuery(listId); var result = await _mediator.Send(query, cancellationToken); return Ok(result); } [HttpGet] [Route("api/lists/{listId:int}/fields/default-view")] public async Task<IActionResult> GetDefaultViewFields(int listId, CancellationToken cancellationToken) { var query = new GetDefaultViewFieldsQuery(CurrentUserLogin, listId); var result = await _mediator.Send(query, cancellationToken); return Ok(result); } [HttpPost] [Route("api/lists/{listId:int}/fields/{fieldId:int}")] public async Task<IActionResult> UpdateField(int listId, int fieldId, [FromBody] Field field, CancellationToken cancellationToken) { var command = new UpdateFieldCommand(listId, fieldId, field); var result = await _mediator.Send(command, cancellationToken); return Ok(result); } [HttpGet] [Route("api/lists/{listId:int}/fields/groups/{groupId:int}/count")] public async Task<IActionResult> GetGroupCount(int listId, int groupId, CancellationToken cancellationToken) { var query = new GetGroupCountQuery(listId, groupId); var result = await _mediator.Send(query, cancellationToken); return Ok(result); } [HttpDelete] [Route("api/lists/{listId:int}/fields/{fieldId:int}")] public async Task<IActionResult> Delete(int listId, int fieldId, CancellationToken cancellationToken) { var command = new DeleteFieldCommand(listId, fieldId); await _mediator.Send(command, cancellationToken); return Ok(); } [HttpGet] [Route("api/lists/{listId:int}/fields/filter")] public async Task<IActionResult> GetFilterFields(int listId, CancellationToken cancellationToken) { var query = new GetFilterFieldsQuery(listId); var result = await _mediator.Send(query, cancellationToken); return Ok(result); } } }