diff --git a/SfeduSchedule/Controllers/ScheduleController.cs b/SfeduSchedule/Controllers/ScheduleController.cs
index 9969e3f..3179a1d 100644
--- a/SfeduSchedule/Controllers/ScheduleController.cs
+++ b/SfeduSchedule/Controllers/ScheduleController.cs
@@ -11,14 +11,36 @@ namespace SfeduSchedule.Controllers
public ScheduleController(ModeusService modeusService) =>
_modeusService = modeusService;
+ ///
+ /// Получить расписание для указанных пользователей.
+ ///
+ /// Список GUID пользователей, для которых запрашивается расписание.
+ /// Список событий расписания.
+ /// Возвращает расписание
[HttpGet]
- public async Task Get([FromQuery] List attendeePersonId)
+ public async Task Get([FromQuery] List attendeePersonId, [FromQuery] DateTime? startDate, [FromQuery] DateTime? endDate)
{
- var msr = new ModeusScheduleRequest(500, DateTime.UtcNow, DateTime.UtcNow.AddDays(20), attendeePersonId);
+ if (!startDate.HasValue)
+ {
+ startDate = DateTime.UtcNow;
+ }
+
+ if (!endDate.HasValue)
+ {
+ endDate = DateTime.UtcNow.AddDays(20);
+ }
+
+ var msr = new ModeusScheduleRequest(500, (DateTime)startDate, (DateTime)endDate, attendeePersonId);
var schedule = await _modeusService.GetScheduleAsync(msr);
return Ok(schedule);
}
+ ///
+ /// Получить расписание по пользовательскому запросу.
+ ///
+ /// Объект запроса, содержащий параметры фильтрации расписания.
+ /// Список событий расписания.
+ /// Возвращает расписание
[HttpPost]
public async Task Post([FromBody] ModeusScheduleRequest request)
{
diff --git a/SfeduSchedule/Controllers/SfeduController.cs b/SfeduSchedule/Controllers/SfeduController.cs
index 15854e5..8a1fcf8 100644
--- a/SfeduSchedule/Controllers/SfeduController.cs
+++ b/SfeduSchedule/Controllers/SfeduController.cs
@@ -13,9 +13,17 @@ namespace SfeduSchedule.Controllers
public SfeduController(ModeusService modeusService) =>
_modeusService = modeusService;
+ ///
+ /// Получить GUID пользователя через авторизацию Microsoft.
+ ///
+ /// Необязательный параметр. Если указан, произойдет редирект на указанный URI после получения GUID. (/?guid=XXX)
+ /// Строка GUID пользователя или редирект на указанный URI.
+ /// Возвращает GUID пользователя
+ /// Редирект на указанный URI
+ /// Ошибка при получении имени пользователя или GUID
[HttpGet]
[Route("guid")]
- public async Task Get()
+ public async Task Get([FromQuery] string? redirectUri)
{
var name = User.FindFirst("name")?.Value;
if (string.IsNullOrEmpty(name))
@@ -25,6 +33,11 @@ namespace SfeduSchedule.Controllers
if (string.IsNullOrEmpty(guid))
return StatusCode(StatusCodes.Status500InternalServerError);
+ if (!string.IsNullOrEmpty(redirectUri))
+ {
+ return Redirect(redirectUri + "?guid=" + guid);
+ }
+
return Ok(guid);
}