diff --git a/src/Vulder.Timetable.Application/Branch/GetBranches/GetBranchesRequestHandler.cs b/src/Vulder.Timetable.Application/Branch/GetBranches/GetBranchesRequestHandler.cs index cf175d1..bac0812 100644 --- a/src/Vulder.Timetable.Application/Branch/GetBranches/GetBranchesRequestHandler.cs +++ b/src/Vulder.Timetable.Application/Branch/GetBranches/GetBranchesRequestHandler.cs @@ -24,7 +24,7 @@ public GetBranchesRequestHandler(IBranchRepository branchRepository) return branchesFromCache.Branches; var schoolModel = await SchoolApi.GetSchoolModel(request.SchoolId); - var newSchoolBranches = await Api.GetBranchListAsync(schoolModel.TimetableUrl); + var newSchoolBranches = await OptivulcanApi.GetBranches(schoolModel.TimetableUrl!); var branchCache = new BranchCache { Branches = newSchoolBranches diff --git a/src/Vulder.Timetable.Application/Timetable/GetTimetable/GetTimetableRequestHandler.cs b/src/Vulder.Timetable.Application/Timetable/GetTimetable/GetTimetableRequestHandler.cs index 98d8d5e..c4996cc 100644 --- a/src/Vulder.Timetable.Application/Timetable/GetTimetable/GetTimetableRequestHandler.cs +++ b/src/Vulder.Timetable.Application/Timetable/GetTimetable/GetTimetableRequestHandler.cs @@ -24,7 +24,7 @@ public GetTimetableRequestHandler(ITimetableRepository timetableRepository) return timetableFromCache.Timetable; var schoolModel = await SchoolApi.GetSchoolModel(request.SchoolId); - var newTimetable = await Api.GetTimetableAsync(schoolModel.TimetableUrl + request.ShortPath); + var newTimetable = await OptivulcanApi.GetTimetable(schoolModel.TimetableUrl + request.ShortPath); var timetableCache = new TimetableCache { diff --git a/src/Vulder.Timetable.Application/Vulder.Timetable.Application.csproj b/src/Vulder.Timetable.Application/Vulder.Timetable.Application.csproj index 7ae4ba1..84e28c5 100644 --- a/src/Vulder.Timetable.Application/Vulder.Timetable.Application.csproj +++ b/src/Vulder.Timetable.Application/Vulder.Timetable.Application.csproj @@ -7,14 +7,14 @@ - - - + + + - - + + diff --git a/src/Vulder.Timetable.Core/Vulder.Timetable.Core.csproj b/src/Vulder.Timetable.Core/Vulder.Timetable.Core.csproj index 541832e..e12e945 100644 --- a/src/Vulder.Timetable.Core/Vulder.Timetable.Core.csproj +++ b/src/Vulder.Timetable.Core/Vulder.Timetable.Core.csproj @@ -7,8 +7,8 @@ - - + + diff --git a/src/Vulder.Timetable.Infrastructure/Redis/Repositories/BranchRepository.cs b/src/Vulder.Timetable.Infrastructure/Redis/Repositories/BranchRepository.cs index 737c62e..b002e85 100644 --- a/src/Vulder.Timetable.Infrastructure/Redis/Repositories/BranchRepository.cs +++ b/src/Vulder.Timetable.Infrastructure/Redis/Repositories/BranchRepository.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json; using StackExchange.Redis; using Vulder.Timetable.Core.ProjectAggregate.Branch; using Vulder.Timetable.Infrastructure.Redis.Interfaces; @@ -16,7 +16,7 @@ public BranchRepository(RedisContext context) public async Task Create(Guid schoolId, BranchCache branch) { - await Branches.StringSetAsync(schoolId.ToString(), JsonConvert.SerializeObject(branch)); + await Branches.StringSetAsync(schoolId.ToString(), JsonSerializer.Serialize(branch)); } public async Task GetBranchById(Guid schoolId) @@ -25,9 +25,9 @@ public async Task Create(Guid schoolId, BranchCache branch) { var branch = await Branches.StringGetAsync(schoolId.ToString()); - return branch.ToString() == null ? null : JsonConvert.DeserializeObject(branch.ToString()); + return branch.ToString() == null ? null : JsonSerializer.Deserialize(branch.ToString()); } - catch (JsonSerializationException) + catch (JsonException) { return null; } diff --git a/src/Vulder.Timetable.Infrastructure/Redis/Repositories/TimetableRepository.cs b/src/Vulder.Timetable.Infrastructure/Redis/Repositories/TimetableRepository.cs index 79a9056..0a4faec 100644 --- a/src/Vulder.Timetable.Infrastructure/Redis/Repositories/TimetableRepository.cs +++ b/src/Vulder.Timetable.Infrastructure/Redis/Repositories/TimetableRepository.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json; using StackExchange.Redis; using Vulder.Timetable.Core.ProjectAggregate.Timetable; using Vulder.Timetable.Infrastructure.Redis.Interfaces; @@ -16,7 +16,7 @@ public TimetableRepository(RedisContext context) public async Task Create(Guid? schoolId, string? className, TimetableCache timetable) { - await Timetables.StringSetAsync(GetTimetableKey(schoolId, className), JsonConvert.SerializeObject(timetable)); + await Timetables.StringSetAsync(GetTimetableKey(schoolId, className), JsonSerializer.Serialize(timetable)); } public async Task GetTimetableById(Guid? schoolId, string? className) @@ -27,9 +27,9 @@ public async Task Create(Guid? schoolId, string? className, TimetableCache timet return timetable.ToString() == null ? null - : JsonConvert.DeserializeObject(timetable.ToString()); + : JsonSerializer.Deserialize(timetable.ToString()); } - catch (JsonSerializationException) + catch (JsonException) { return null; } diff --git a/src/Vulder.Timetable.Infrastructure/Vulder.Timetable.Infrastructure.csproj b/src/Vulder.Timetable.Infrastructure/Vulder.Timetable.Infrastructure.csproj index d1b1787..b833c34 100644 --- a/src/Vulder.Timetable.Infrastructure/Vulder.Timetable.Infrastructure.csproj +++ b/src/Vulder.Timetable.Infrastructure/Vulder.Timetable.Infrastructure.csproj @@ -7,18 +7,18 @@ - - - - - - - - + + + + + + + + - + diff --git a/test/Vulder.Timetable.IntegrationTests/Controllers/ControllersTest.cs b/test/Vulder.Timetable.IntegrationTests/Controllers/ControllersTest.cs index 009e40e..6c2bdca 100644 --- a/test/Vulder.Timetable.IntegrationTests/Controllers/ControllersTest.cs +++ b/test/Vulder.Timetable.IntegrationTests/Controllers/ControllersTest.cs @@ -12,7 +12,7 @@ namespace Vulder.Timetable.IntegrationTests.Controllers; public class ControllersTest : IDisposable { private const string ClassName = "6A"; - private const string ShortUrl = "%2Fplany%2Fs2.html"; + private const string ShortUrl = "/plany/o1.html"; private readonly GetSchoolResponse _schoolTestModel; private readonly WireMockServer _server;