feat: return the schedule-related settings
All checks were successful
.NET Test Pipeline / build-and-test (pull_request) Successful in 1m43s

This commit is contained in:
Polianin Nikita 2024-05-29 07:38:32 +03:00
parent f6f7ed6c86
commit 081c814036

View File

@ -1,11 +1,16 @@
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using Mirea.Api.DataAccess.Application.Cqrs.Schedule.Queries.GetScheduleList;
using Mirea.Api.Dto.Common;
using Mirea.Api.Dto.Requests;
using Mirea.Api.Dto.Responses;
using Mirea.Api.Dto.Responses.Schedule;
using Mirea.Api.Endpoint.Common.Attributes;
using Mirea.Api.Endpoint.Common.Services;
using Mirea.Api.Endpoint.Configuration.General;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
@ -13,8 +18,14 @@ using System.Threading.Tasks;
namespace Mirea.Api.Endpoint.Controllers.V1;
[ApiVersion("1.0")]
public class ScheduleController(IMediator mediator) : BaseController
public class ScheduleController(IMediator mediator, IOptionsSnapshot<GeneralConfig> config) : BaseController
{
[HttpGet("StartTerm")]
public ActionResult<DateOnly> GetStartTerm() => config.Value.ScheduleSettings!.StartTerm;
[HttpGet("PairPeriod")]
public ActionResult<Dictionary<int, PairPeriodTime>> GetPairPeriod() => config.Value.ScheduleSettings!.PairPeriod.ConvertToDto();
/// <summary>
/// Retrieves schedules based on various filters.
/// </summary>