feat: add cache control in response
This commit is contained in:
@ -17,11 +17,14 @@ using System.Threading.Tasks;
|
||||
namespace Mirea.Api.Endpoint.Controllers.V1;
|
||||
|
||||
[ApiVersion("1.0")]
|
||||
[CacheMaxAge(true)]
|
||||
public class ScheduleController(IMediator mediator, IOptionsSnapshot<GeneralConfig> config) : BaseController
|
||||
{
|
||||
[CacheMaxAge(1, 0)]
|
||||
[HttpGet("StartTerm")]
|
||||
public ActionResult<DateOnly> GetStartTerm() => config.Value.ScheduleSettings!.StartTerm;
|
||||
|
||||
[CacheMaxAge(1, 0)]
|
||||
[HttpGet("PairPeriod")]
|
||||
public ActionResult<Dictionary<int, PairPeriodTime>> GetPairPeriod() => config.Value.ScheduleSettings!.PairPeriod.ConvertToDto();
|
||||
|
||||
@ -105,7 +108,7 @@ public class ScheduleController(IMediator mediator, IOptionsSnapshot<GeneralConf
|
||||
[FromQuery] int[]? professors = null,
|
||||
[FromQuery] int[]? lectureHalls = null) =>
|
||||
await Get(new ScheduleRequest
|
||||
{
|
||||
{
|
||||
Disciplines = disciplines,
|
||||
IsEven = isEven,
|
||||
Groups = [id],
|
||||
@ -133,7 +136,7 @@ public class ScheduleController(IMediator mediator, IOptionsSnapshot<GeneralConf
|
||||
[FromQuery] int[]? groups = null,
|
||||
[FromQuery] int[]? lectureHalls = null) =>
|
||||
await Get(new ScheduleRequest
|
||||
{
|
||||
{
|
||||
Disciplines = disciplines,
|
||||
IsEven = isEven,
|
||||
Groups = groups,
|
||||
@ -161,7 +164,7 @@ public class ScheduleController(IMediator mediator, IOptionsSnapshot<GeneralConf
|
||||
[FromQuery] int[]? groups = null,
|
||||
[FromQuery] int[]? professors = null) =>
|
||||
await Get(new ScheduleRequest
|
||||
{
|
||||
{
|
||||
Disciplines = disciplines,
|
||||
IsEven = isEven,
|
||||
Groups = groups,
|
||||
@ -189,11 +192,11 @@ public class ScheduleController(IMediator mediator, IOptionsSnapshot<GeneralConf
|
||||
[FromQuery] int[]? professors = null,
|
||||
[FromQuery] int[]? lectureHalls = null) =>
|
||||
await Get(new ScheduleRequest
|
||||
{
|
||||
{
|
||||
Disciplines = [id],
|
||||
IsEven = isEven,
|
||||
Groups = groups,
|
||||
Professors = professors,
|
||||
LectureHalls = lectureHalls
|
||||
});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user