From 081c814036f86cf8714d93159ca18eec3054e225 Mon Sep 17 00:00:00 2001 From: Polianin Nikita Date: Wed, 29 May 2024 07:38:32 +0300 Subject: [PATCH] feat: return the schedule-related settings --- Endpoint/Controllers/V1/ScheduleController.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Endpoint/Controllers/V1/ScheduleController.cs b/Endpoint/Controllers/V1/ScheduleController.cs index a0d5b7b..904e3d2 100644 --- a/Endpoint/Controllers/V1/ScheduleController.cs +++ b/Endpoint/Controllers/V1/ScheduleController.cs @@ -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 config) : BaseController { + [HttpGet("StartTerm")] + public ActionResult GetStartTerm() => config.Value.ScheduleSettings!.StartTerm; + + [HttpGet("PairPeriod")] + public ActionResult> GetPairPeriod() => config.Value.ScheduleSettings!.PairPeriod.ConvertToDto(); + /// /// Retrieves schedules based on various filters. ///