feat: улучшил синхронизацию лекций
🚀 Create and publish a Docker image / Detect changes in backend and frontend (push) Failing after 10m14s
Frontend CI / build-and-check (push) Failing after 16m12s
🚀 Create and publish a Docker image / Build & publish frontend image (push) Failing after 14m7s
🚀 Create and publish a Docker image / Build & publish backend image (push) Failing after 14m59s
🚀 Create and publish a Docker image / Update stack on Portainer (push) Failing after 14m57s
Backend CI / build-and-test (push) Failing after 13m27s
🚀 Create and publish a Docker image / Detect changes in backend and frontend (push) Failing after 10m14s
Frontend CI / build-and-check (push) Failing after 16m12s
🚀 Create and publish a Docker image / Build & publish frontend image (push) Failing after 14m7s
🚀 Create and publish a Docker image / Build & publish backend image (push) Failing after 14m59s
🚀 Create and publish a Docker image / Update stack on Portainer (push) Failing after 14m57s
Backend CI / build-and-test (push) Failing after 13m27s
This commit is contained in:
@@ -24,29 +24,30 @@ public class ModeusApiClient : IModeusApiClient
|
||||
|
||||
public async Task<ModeusEventsResponse> SearchEventsAsync(SyncScheduleRequest request)
|
||||
{
|
||||
const int pageSize = 900;
|
||||
var specialtyCodes = string.IsNullOrWhiteSpace(request.SpecialtyCode)
|
||||
? []
|
||||
: request.SpecialtyCode
|
||||
.Split(',', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
||||
var typeIds = request.TypeId ?? [];
|
||||
var pageSize = request.Size is > 0 ? request.Size.Value : 900;
|
||||
var body = new Dictionary<string, object?>
|
||||
{
|
||||
["size"] = pageSize,
|
||||
["timeMin"] = request.TimeMin,
|
||||
["timeMax"] = request.TimeMax,
|
||||
["specialtyCode"] = specialtyCodes
|
||||
["timeMax"] = request.TimeMax
|
||||
};
|
||||
|
||||
if (typeIds.Count > 0)
|
||||
body["typeId"] = typeIds;
|
||||
AddNonEmpty(body, "roomId", request.RoomId);
|
||||
AddNonEmpty(body, "attendeePersonId", request.AttendeePersonId);
|
||||
AddNonEmpty(body, "courseUnitRealizationId", request.CourseUnitRealizationId);
|
||||
AddNonEmpty(body, "cycleRealizationId", request.CycleRealizationId);
|
||||
AddNonEmpty(body, "specialtyCode", request.SpecialtyCode);
|
||||
AddNonEmpty(body, "learningStartYear", request.LearningStartYear);
|
||||
AddNonEmpty(body, "profileName", request.ProfileName);
|
||||
AddNonEmpty(body, "curriculumId", request.CurriculumId);
|
||||
AddNonEmpty(body, "typeId", request.TypeId);
|
||||
|
||||
var response = await _http.PostAsJsonAsync("/api/proxy/events/search", body);
|
||||
var requestJson = JsonSerializer.Serialize(body);
|
||||
await EnsureSuccessAsync(response, "Modeus events search",
|
||||
BuildEventsRequestSummary(pageSize, specialtyCodes, request.TimeMin, request.TimeMax, typeIds, requestJson));
|
||||
BuildEventsRequestSummary(requestJson));
|
||||
return await ReadJsonAsync<ModeusEventsResponse>(response, "Modeus events search",
|
||||
BuildEventsRequestSummary(pageSize, specialtyCodes, request.TimeMin, request.TimeMax, typeIds, requestJson))
|
||||
BuildEventsRequestSummary(requestJson))
|
||||
?? new ModeusEventsResponse();
|
||||
}
|
||||
|
||||
@@ -97,16 +98,15 @@ public class ModeusApiClient : IModeusApiClient
|
||||
response.StatusCode);
|
||||
}
|
||||
|
||||
private static string BuildEventsRequestSummary(
|
||||
int size,
|
||||
IReadOnlyList<string> specialtyCodes,
|
||||
DateTime? timeMin,
|
||||
DateTime? timeMax,
|
||||
IReadOnlyList<string> typeIds,
|
||||
string requestJson)
|
||||
private static string BuildEventsRequestSummary(string requestJson) => $"Request JSON: {requestJson}";
|
||||
|
||||
private static void AddNonEmpty<T>(
|
||||
IDictionary<string, object?> body,
|
||||
string key,
|
||||
IReadOnlyList<T>? values)
|
||||
{
|
||||
var typeFilter = typeIds.Count > 0 ? $"typeId=[{string.Join(", ", typeIds)}]" : "typeId=<omitted>";
|
||||
return $"size={size}, specialtyCode=[{string.Join(", ", specialtyCodes)}], timeMin={timeMin:O}, timeMax={timeMax:O}, {typeFilter}. Request JSON: {requestJson}";
|
||||
if (values is { Count: > 0 })
|
||||
body[key] = values;
|
||||
}
|
||||
|
||||
private static async Task<T?> ReadJsonAsync<T>(HttpResponseMessage response, string operation, string requestSummary)
|
||||
|
||||
Reference in New Issue
Block a user