Notable days next

This commit is contained in:
2025-09-07 14:42:37 +08:00
parent 52430c19a5
commit d7ad84e199
2 changed files with 49 additions and 0 deletions

View File

@@ -48,4 +48,32 @@ public class NotableDaysController(NotableDaysService days) : ControllerBase
var result = await days.GetNotableDays(currentYear, region);
return Ok(result);
}
[HttpGet("{regionCode}/next")]
public async Task<ActionResult<NotableDay?>> GetNextHoliday(string regionCode)
{
var result = await days.GetNextHoliday(regionCode);
if (result == null)
{
return NotFound("No upcoming holidays found");
}
return Ok(result);
}
[HttpGet("me/next")]
[Authorize]
public async Task<ActionResult<NotableDay?>> GetAccountNextHoliday()
{
if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized();
var region = currentUser.Region;
if (string.IsNullOrWhiteSpace(region)) region = "us";
var result = await days.GetNextHoliday(region);
if (result == null)
{
return NotFound("No upcoming holidays found");
}
return Ok(result);
}
}