/
softailor
/
gridient
Обзор
Документация
Войти
/
softailor
/
gridient
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
backend/Gridient.Core/Controllers/UserReportFieldsController.cs
50 строк
2 KB
Jenkins
Auto add
18 фев 2026, 10:19
18 фев 2026, 10:19
1e6c4f8
Код
Авторство
О чём код?
using Gridient.Core.Features.UserReportFields.Commands; using Gridient.Core.Features.UserReportFields.Queries; using Gridient.Core.Models; using MediatR; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using UserReportFieldsModel = Gridient.Core.Models.UserReportFields; namespace Gridient.Core.Controllers { [Route("api/[controller]")] [ApiController] [Authorize] public class UserReportFieldsController(IMediator mediator) : ListsBaseController { private readonly IMediator _mediator = mediator; [HttpGet(nameof(GetUserReportFields))] public async Task<IActionResult> GetUserReportFields([FromQuery] UserListRequest request, CancellationToken cancellationToken) { var query = new GetUserReportFieldsQuery(request.UserId, request.ListId); var result = await _mediator.Send(query, cancellationToken); return Ok(result); } [HttpPost(nameof(Add))] public async Task<ActionResult> Add([FromBody] UserReportFieldsModel reportFields, CancellationToken cancellationToken) { var command = new AddUserReportFieldsCommand(reportFields); var newUserReportFields = await _mediator.Send(command, cancellationToken); return Ok(newUserReportFields); } [HttpPost(nameof(Update))] public async Task<ActionResult> Update([FromBody] UserReportFieldsModel reportFields, CancellationToken cancellationToken) { var command = new UpdateUserReportFieldsCommand(reportFields); await _mediator.Send(command, cancellationToken); return Ok(); } [HttpDelete(nameof(Delete) + "/{id:int}")] public async Task<IActionResult> Delete(int id, CancellationToken cancellationToken) { var command = new DeleteUserReportFieldsCommand(id); await _mediator.Send(command, cancellationToken); return Ok(); } } }