2023-09-15 16:32:46 +10:00
|
|
|
|
using AutoMapper;
|
2023-12-04 10:16:00 +10:00
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
2023-09-15 16:32:46 +10:00
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
|
using PARR.API.Contracts.V1;
|
|
|
|
|
|
using PARR.API.Contracts.V1.Responses;
|
|
|
|
|
|
using PARR.API.Contracts.V1.Responses.Base;
|
|
|
|
|
|
using PARR.API.Controllers.V1.Base;
|
2023-10-03 14:30:54 +10:00
|
|
|
|
using PARR.DAL.Services.Interfaces;
|
2026-04-14 12:01:49 +10:00
|
|
|
|
using PARR.Domain.Common.Roles;
|
2023-09-15 16:32:46 +10:00
|
|
|
|
|
|
|
|
|
|
namespace PARR.API.Controllers.V1
|
|
|
|
|
|
{
|
2023-12-04 10:16:00 +10:00
|
|
|
|
[Authorize(Roles = ParrRoles.EsppRobot.RoleOrAdmin)]
|
2023-10-06 14:24:58 +10:00
|
|
|
|
public class TaskStatusController : BaseApiController
|
2023-09-15 16:32:46 +10:00
|
|
|
|
{
|
|
|
|
|
|
private readonly IMapper mapper;
|
|
|
|
|
|
private readonly IStatusTemplateService statusTemplateService;
|
|
|
|
|
|
|
2023-10-06 14:24:58 +10:00
|
|
|
|
public TaskStatusController(
|
2023-09-15 16:32:46 +10:00
|
|
|
|
IMapper mapper,
|
|
|
|
|
|
IStatusTemplateService statusTemplateService
|
|
|
|
|
|
)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.mapper = mapper;
|
|
|
|
|
|
this.statusTemplateService = statusTemplateService;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2023-10-06 14:24:58 +10:00
|
|
|
|
/// Получить список статусов заданий
|
2023-09-15 16:32:46 +10:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
2023-10-06 14:24:58 +10:00
|
|
|
|
[HttpGet(ApiRoutes.TaskStatus.GetAll)]
|
2023-09-15 16:32:46 +10:00
|
|
|
|
public async Task<IActionResult> GetAll()
|
|
|
|
|
|
{
|
|
|
|
|
|
var statusList = await statusTemplateService.Get()
|
|
|
|
|
|
.OrderBy(t => t.Code)
|
|
|
|
|
|
.ToListAsync();
|
|
|
|
|
|
|
2023-10-06 14:24:58 +10:00
|
|
|
|
var response = mapper.Map<List<TaskStatusResponse>>(statusList);
|
2023-09-15 16:32:46 +10:00
|
|
|
|
|
2023-10-06 14:24:58 +10:00
|
|
|
|
return Ok(new Response<List<TaskStatusResponse>>(response, true));
|
2023-09-15 16:32:46 +10:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|