using AutoMapper; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using PARR.API.Contracts.V1; using PARR.API.Contracts.V1.Requests; using PARR.API.Contracts.V1.Requests.Queries; using PARR.API.Contracts.V1.Responses; using PARR.API.Contracts.V1.Responses.Base; using PARR.API.Controllers.V1.Base; using PARR.API.Extensions; using PARR.API.Services.Interfaces; using PARR.BLL.Helpers; using PARR.DAL.Contracts; using PARR.DAL.DomainServices.Shortcodes; using PARR.DAL.Models; using PARR.DAL.Services.Interfaces; using PARR.DAL.Services.Interfaces.Schedule; using PARR.Domain.Common.Pagination; using PARR.Domain.Common.Roles; using PARR.Domain.Entities.Base.History; using PARR.Domain.Enums; namespace PARR.API.Controllers.V1 { /// /// Шаблоны /// [Authorize(Roles = ParrRoles.Administrator.Role)] public class TemplateController : BaseApiController { private readonly IMapper mapper; private readonly ITemplateService templateService; private readonly IRobotConfigurationService robotConfigurationService; private readonly IClientService clientService; private readonly ILogger logger; private readonly IShortcodesService shortcodesService; private readonly IOrderService orderService; private readonly SettingsFromDb settingsFromDb; private readonly IScheduleResponseAreaTimeOffsetService scheduleResponseAreaTimeOffsetService; public TemplateController( IMapper mapper, ITemplateService templateService, IRobotConfigurationService robotConfigurationService, IClientService clientService, ILogger logger, IShortcodesService shortcodesService, IOrderService orderService, SettingsFromDb settingsFromDb, IScheduleResponseAreaTimeOffsetService scheduleResponseAreaTimeOffsetService ) { this.mapper = mapper; this.templateService = templateService; this.robotConfigurationService = robotConfigurationService; this.clientService = clientService; this.logger = logger; this.shortcodesService = shortcodesService; this.orderService = orderService; this.settingsFromDb = settingsFromDb; this.scheduleResponseAreaTimeOffsetService = scheduleResponseAreaTimeOffsetService; } /// /// Получить список всех шаблонов постранично /// /// /// [HttpGet(ApiRoutes.Template.GetAll)] public async Task GetAll([FromQuery] PaginationQuery paginationQuery, [FromQuery] TemplateQuery filter) { var paginationFilter = mapper.Map(paginationQuery); IQueryable