Добавил более подробное логирование
Some checks failed
Create and publish a Docker image / Publish image (push) Failing after 1m36s
Some checks failed
Create and publish a Docker image / Publish image (push) Failing after 1m36s
This commit is contained in:
353
SfeduSchedule.Plugin.Abstractions/ScheduleDTO.CS
Normal file
353
SfeduSchedule.Plugin.Abstractions/ScheduleDTO.CS
Normal file
@@ -0,0 +1,353 @@
|
||||
namespace SfeduSchedule.Plugin.Abstractions;
|
||||
|
||||
// Root myDeserializedClass = JsonConvert.DeserializeObject<Root>(myJsonResponse);
|
||||
public class Building
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string name { get; set; }
|
||||
public string nameShort { get; set; }
|
||||
public string address { get; set; }
|
||||
public int displayOrder { get; set; }
|
||||
public string href { get; set; }
|
||||
}
|
||||
|
||||
public class Building3
|
||||
{
|
||||
public string name { get; set; }
|
||||
public string nameShort { get; set; }
|
||||
public string address { get; set; }
|
||||
public string searchableAddress { get; set; }
|
||||
public int displayOrder { get; set; }
|
||||
public Links _links { get; set; }
|
||||
public string id { get; set; }
|
||||
}
|
||||
|
||||
public class CourseUnitRealization
|
||||
{
|
||||
public string href { get; set; }
|
||||
}
|
||||
|
||||
public class CourseUnitRealization2
|
||||
{
|
||||
public string name { get; set; }
|
||||
public string nameShort { get; set; }
|
||||
public string prototypeId { get; set; }
|
||||
public Links _links { get; set; }
|
||||
public string id { get; set; }
|
||||
}
|
||||
|
||||
public class CycleRealization
|
||||
{
|
||||
public string href { get; set; }
|
||||
}
|
||||
|
||||
public class CycleRealization2
|
||||
{
|
||||
public string name { get; set; }
|
||||
public string nameShort { get; set; }
|
||||
public string code { get; set; }
|
||||
public string courseUnitRealizationNameShort { get; set; }
|
||||
public Links _links { get; set; }
|
||||
public string id { get; set; }
|
||||
}
|
||||
|
||||
public class Duration
|
||||
{
|
||||
public string href { get; set; }
|
||||
}
|
||||
|
||||
public class Duration2
|
||||
{
|
||||
public string eventId { get; set; }
|
||||
public int value { get; set; }
|
||||
public string timeUnitId { get; set; }
|
||||
public int minutes { get; set; }
|
||||
public Links _links { get; set; }
|
||||
}
|
||||
|
||||
public class Embedded
|
||||
{
|
||||
public List<Event> events { get; set; }
|
||||
|
||||
[JsonProperty("course-unit-realizations")]
|
||||
public List<CourseUnitRealization> courseunitrealizations { get; set; }
|
||||
|
||||
[JsonProperty("cycle-realizations")] public List<CycleRealization> cyclerealizations { get; set; }
|
||||
|
||||
[JsonProperty("lesson-realization-teams")]
|
||||
public List<LessonRealizationTeam> lessonrealizationteams { get; set; }
|
||||
|
||||
[JsonProperty("lesson-realizations")] public List<LessonRealization> lessonrealizations { get; set; }
|
||||
|
||||
[JsonProperty("event-locations")] public List<EventLocation> eventlocations { get; set; }
|
||||
|
||||
public List<Duration> durations { get; set; }
|
||||
|
||||
[JsonProperty("event-rooms")] public List<EventRoom> eventrooms { get; set; }
|
||||
|
||||
public List<Room> rooms { get; set; }
|
||||
public List<Building> buildings { get; set; }
|
||||
|
||||
[JsonProperty("event-teams")] public List<EventTeam> eventteams { get; set; }
|
||||
|
||||
[JsonProperty("event-organizers")] public List<EventOrganizer> eventorganizers { get; set; }
|
||||
|
||||
[JsonProperty("event-attendees")] public List<EventAttendee> eventattendees { get; set; }
|
||||
|
||||
public List<Person> persons { get; set; }
|
||||
}
|
||||
|
||||
public class Event
|
||||
{
|
||||
public string name { get; set; }
|
||||
public string nameShort { get; set; }
|
||||
public object description { get; set; }
|
||||
public string typeId { get; set; }
|
||||
public string formatId { get; set; }
|
||||
public DateTime start { get; set; }
|
||||
public DateTime end { get; set; }
|
||||
public DateTime startsAtLocal { get; set; }
|
||||
public DateTime endsAtLocal { get; set; }
|
||||
public DateTime startsAt { get; set; }
|
||||
public DateTime endsAt { get; set; }
|
||||
public HoldingStatus holdingStatus { get; set; }
|
||||
public object repeatedLessonRealization { get; set; }
|
||||
public List<string> userRoleIds { get; set; }
|
||||
public string lessonTemplateId { get; set; }
|
||||
public int __version { get; set; }
|
||||
public Links _links { get; set; }
|
||||
public string id { get; set; }
|
||||
}
|
||||
|
||||
public class Event2
|
||||
{
|
||||
public string href { get; set; }
|
||||
}
|
||||
|
||||
public class EventAttendee
|
||||
{
|
||||
public string roleId { get; set; }
|
||||
public string roleName { get; set; }
|
||||
public string roleNamePlural { get; set; }
|
||||
public int roleDisplayOrder { get; set; }
|
||||
public Links _links { get; set; }
|
||||
public string id { get; set; }
|
||||
}
|
||||
|
||||
public class EventLocation
|
||||
{
|
||||
public string eventId { get; set; }
|
||||
public object customLocation { get; set; }
|
||||
public Links _links { get; set; }
|
||||
}
|
||||
|
||||
public class EventOrganizer
|
||||
{
|
||||
public string eventId { get; set; }
|
||||
public Links _links { get; set; }
|
||||
}
|
||||
|
||||
public class EventRoom
|
||||
{
|
||||
public Links _links { get; set; }
|
||||
public string id { get; set; }
|
||||
public string href { get; set; }
|
||||
}
|
||||
|
||||
public class EventTeam
|
||||
{
|
||||
public string eventId { get; set; }
|
||||
public int size { get; set; }
|
||||
public Links _links { get; set; }
|
||||
}
|
||||
|
||||
public class Format
|
||||
{
|
||||
public string href { get; set; }
|
||||
}
|
||||
|
||||
public class Grid
|
||||
{
|
||||
public string href { get; set; }
|
||||
}
|
||||
|
||||
public class HoldingStatus
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string name { get; set; }
|
||||
public DateTime? audModifiedAt { get; set; }
|
||||
public string audModifiedBy { get; set; }
|
||||
public bool? audModifiedBySystem { get; set; }
|
||||
}
|
||||
|
||||
public class HoldingStatusModifiedBy
|
||||
{
|
||||
public string href { get; set; }
|
||||
}
|
||||
|
||||
public class LessonRealization
|
||||
{
|
||||
public string href { get; set; }
|
||||
}
|
||||
|
||||
public class LessonRealization2
|
||||
{
|
||||
public string name { get; set; }
|
||||
public string nameShort { get; set; }
|
||||
public string prototypeId { get; set; }
|
||||
public int ordinal { get; set; }
|
||||
public Links _links { get; set; }
|
||||
public string id { get; set; }
|
||||
}
|
||||
|
||||
public class LessonRealizationTeam
|
||||
{
|
||||
public string href { get; set; }
|
||||
}
|
||||
|
||||
public class LessonRealizationTeam2
|
||||
{
|
||||
public string name { get; set; }
|
||||
public string cycleRealizationId { get; set; }
|
||||
public Links _links { get; set; }
|
||||
public string id { get; set; }
|
||||
}
|
||||
|
||||
public class LessonRealizationTemplate
|
||||
{
|
||||
public string href { get; set; }
|
||||
}
|
||||
|
||||
public class Links
|
||||
{
|
||||
public Self self { get; set; }
|
||||
public Type type { get; set; }
|
||||
public Format format { get; set; }
|
||||
|
||||
[JsonProperty("time-zone")] public TimeZone timezone { get; set; }
|
||||
|
||||
public Grid grid { get; set; }
|
||||
|
||||
[JsonProperty("course-unit-realization")]
|
||||
public CourseUnitRealization courseunitrealization { get; set; }
|
||||
|
||||
[JsonProperty("cycle-realization")] public CycleRealization cyclerealization { get; set; }
|
||||
|
||||
[JsonProperty("lesson-realization")] public LessonRealization lessonrealization { get; set; }
|
||||
|
||||
[JsonProperty("lesson-realization-team")]
|
||||
public LessonRealizationTeam lessonrealizationteam { get; set; }
|
||||
|
||||
[JsonProperty("lesson-realization-template")]
|
||||
public LessonRealizationTemplate lessonrealizationtemplate { get; set; }
|
||||
|
||||
public Location location { get; set; }
|
||||
public Duration duration { get; set; }
|
||||
public Team team { get; set; }
|
||||
public Organizers organizers { get; set; }
|
||||
|
||||
[JsonProperty("holding-status-modified-by")]
|
||||
public HoldingStatusModifiedBy holdingstatusmodifiedby { get; set; }
|
||||
|
||||
public Event @event { get; set; }
|
||||
|
||||
[JsonProperty("event-attendees")] public object eventattendees { get; set; }
|
||||
|
||||
public Person person { get; set; }
|
||||
|
||||
[JsonProperty("planning-period")] public PlanningPeriod planningperiod { get; set; }
|
||||
|
||||
[JsonProperty("event-rooms")] public EventRooms eventrooms { get; set; }
|
||||
|
||||
[JsonProperty("time-unit")] public TimeUnit timeunit { get; set; }
|
||||
|
||||
public Room room { get; set; }
|
||||
public Building building { get; set; }
|
||||
}
|
||||
|
||||
public class Location
|
||||
{
|
||||
public string href { get; set; }
|
||||
}
|
||||
|
||||
public class Organizers
|
||||
{
|
||||
public string href { get; set; }
|
||||
}
|
||||
|
||||
public class Page
|
||||
{
|
||||
public int size { get; set; }
|
||||
public int totalElements { get; set; }
|
||||
public int totalPages { get; set; }
|
||||
public int number { get; set; }
|
||||
}
|
||||
|
||||
public class Person
|
||||
{
|
||||
public string href { get; set; }
|
||||
}
|
||||
|
||||
public class Person2
|
||||
{
|
||||
public string lastName { get; set; }
|
||||
public string firstName { get; set; }
|
||||
public string middleName { get; set; }
|
||||
public string fullName { get; set; }
|
||||
public Links _links { get; set; }
|
||||
public string id { get; set; }
|
||||
}
|
||||
|
||||
public class PlanningPeriod
|
||||
{
|
||||
public string href { get; set; }
|
||||
}
|
||||
|
||||
public class Room
|
||||
{
|
||||
public string href { get; set; }
|
||||
}
|
||||
|
||||
public class Room2
|
||||
{
|
||||
public string name { get; set; }
|
||||
public string nameShort { get; set; }
|
||||
public Building building { get; set; }
|
||||
public bool projectorAvailable { get; set; }
|
||||
public int totalCapacity { get; set; }
|
||||
public int workingCapacity { get; set; }
|
||||
public object deletedAtUtc { get; set; }
|
||||
public Links _links { get; set; }
|
||||
public string id { get; set; }
|
||||
}
|
||||
|
||||
public class Root
|
||||
{
|
||||
public Embedded _embedded { get; set; }
|
||||
public Page page { get; set; }
|
||||
}
|
||||
|
||||
public class Self
|
||||
{
|
||||
public string href { get; set; }
|
||||
}
|
||||
|
||||
public class Team
|
||||
{
|
||||
public string href { get; set; }
|
||||
}
|
||||
|
||||
public class TimeUnit
|
||||
{
|
||||
public string href { get; set; }
|
||||
}
|
||||
|
||||
public class TimeZone
|
||||
{
|
||||
public string href { get; set; }
|
||||
}
|
||||
|
||||
public class Type
|
||||
{
|
||||
public string href { get; set; }
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Net;
|
||||
using System.Text.Json;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.RateLimiting;
|
||||
@@ -29,7 +30,7 @@ namespace SfeduSchedule.Controllers
|
||||
}
|
||||
catch (HttpRequestException e)
|
||||
{
|
||||
logger.LogError("Ошибка при получении расписания\n\n" + e.Message);
|
||||
logger.LogError("Ошибка при получении расписания\n\n" + e.Message + "\n\n" + e.StackTrace + "\n\n JSON: " + JsonSerializer.Serialize(request));
|
||||
return StatusCode((int)(e.StatusCode ?? HttpStatusCode.InternalServerError), e.Message);
|
||||
}
|
||||
return Ok(schedule);
|
||||
@@ -53,7 +54,7 @@ namespace SfeduSchedule.Controllers
|
||||
}
|
||||
catch (HttpRequestException e)
|
||||
{
|
||||
logger.LogError("Ошибка при поиске аудиторий\n\n" + e.Message);
|
||||
logger.LogError("Ошибка при поиске аудиторий\n\n" + e.Message + "\n\n" + e.StackTrace + "\n\n JSON: " + JsonSerializer.Serialize(request));
|
||||
return StatusCode((int)(e.StatusCode ?? HttpStatusCode.InternalServerError), e.Message);
|
||||
}
|
||||
return Ok(rooms);
|
||||
|
||||
Reference in New Issue
Block a user