diff --git a/GetIntoTeachingApi/GetIntoTeachingApi.csproj b/GetIntoTeachingApi/GetIntoTeachingApi.csproj index 266f4ef28..152255728 100644 --- a/GetIntoTeachingApi/GetIntoTeachingApi.csproj +++ b/GetIntoTeachingApi/GetIntoTeachingApi.csproj @@ -12,6 +12,7 @@ + diff --git a/GetIntoTeachingApi/Jobs/ApplyBackfillJob.cs b/GetIntoTeachingApi/Jobs/ApplyBackfillJob.cs index fb9e33020..a04986fbe 100644 --- a/GetIntoTeachingApi/Jobs/ApplyBackfillJob.cs +++ b/GetIntoTeachingApi/Jobs/ApplyBackfillJob.cs @@ -1,9 +1,10 @@ -using System; -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Flurl; using Flurl.Http; +using Flurl.Http.Newtonsoft; using GetIntoTeachingApi.Adapters; using GetIntoTeachingApi.Models; using GetIntoTeachingApi.Models.Apply; @@ -19,7 +20,7 @@ namespace GetIntoTeachingApi.Jobs [AutomaticRetry(Attempts = 0)] public class ApplyBackfillJob : BaseJob { - public static readonly int PagesPerJob = 10; + public static readonly int PagesPerJob = 10; private readonly IBackgroundJobClient _jobClient; private readonly ILogger _logger; private readonly IAppSettings _appSettings; @@ -54,6 +55,9 @@ private static int EndPage(int startPage) private async Task QueueCandidateSyncJobs(DateTime updatedSince, int startPage) { + // Enforce use of the Newtonsoft Json serializer + FlurlHttp.Clients.UseNewtonsoft(); + var request = Env.ApplyCandidateApiUrl .AppendPathSegment("candidates") .SetQueryParam("updated_since", updatedSince) diff --git a/GetIntoTeachingApi/Jobs/ApplySyncJob.cs b/GetIntoTeachingApi/Jobs/ApplySyncJob.cs index 30fe7f876..e8e726c6e 100644 --- a/GetIntoTeachingApi/Jobs/ApplySyncJob.cs +++ b/GetIntoTeachingApi/Jobs/ApplySyncJob.cs @@ -1,9 +1,10 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Flurl; using Flurl.Http; +using Flurl.Http.Newtonsoft; using GetIntoTeachingApi.Models.Apply; using GetIntoTeachingApi.Services; using GetIntoTeachingApi.Utils; @@ -53,6 +54,9 @@ public async Task RunAsync() private async Task QueueCandidateSyncJobs() { + // Enforce use of the Newtonsoft Json serializer + FlurlHttp.Clients.UseNewtonsoft(); + var request = Env.ApplyCandidateApiUrl .AppendPathSegment("candidates") .SetQueryParam("updated_since", UpdatedSince()) diff --git a/GetIntoTeachingApi/Properties/launchSettings.json b/GetIntoTeachingApi/Properties/launchSettings.json index 85e215d80..788466a27 100644 --- a/GetIntoTeachingApi/Properties/launchSettings.json +++ b/GetIntoTeachingApi/Properties/launchSettings.json @@ -23,7 +23,8 @@ "launchUrl": "swagger", "applicationUrl": "https://localhost:5001;http://localhost:5000", "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" + "ASPNETCORE_ENVIRONMENT": "Development", + "Sentry__Dsn": "" } } } diff --git a/GetIntoTeachingApiTests/Contracts/ApplyCandidateApiTests.cs b/GetIntoTeachingApiTests/Contracts/ApplyCandidateApiTests.cs index 0c779fdbb..1aafd73bd 100644 --- a/GetIntoTeachingApiTests/Contracts/ApplyCandidateApiTests.cs +++ b/GetIntoTeachingApiTests/Contracts/ApplyCandidateApiTests.cs @@ -22,6 +22,9 @@ public async void Contract(string scenario) await Setup(); var candidate = ConstructCandidate(ReadInput(scenario)); + + Assert.NotNull(candidate.Attributes.Email); + JobClient.Enqueue(c => c.Run(candidate)); await AssertRequestMatchesSnapshot(scenario); diff --git a/GetIntoTeachingApiTests/Contracts/Input/ApplyCandidateApi/sync_with_a_new_candidaite_and_application_form.json b/GetIntoTeachingApiTests/Contracts/Input/ApplyCandidateApi/sync_with_a_new_candidate_and_application_form.json similarity index 100% rename from GetIntoTeachingApiTests/Contracts/Input/ApplyCandidateApi/sync_with_a_new_candidaite_and_application_form.json rename to GetIntoTeachingApiTests/Contracts/Input/ApplyCandidateApi/sync_with_a_new_candidate_and_application_form.json diff --git a/GetIntoTeachingApiTests/Contracts/Input/ApplyCandidateApi/sync_with_a_new_candidaite_and_no_application_form.json b/GetIntoTeachingApiTests/Contracts/Input/ApplyCandidateApi/sync_with_a_new_candidate_and_no_application_form.json similarity index 100% rename from GetIntoTeachingApiTests/Contracts/Input/ApplyCandidateApi/sync_with_a_new_candidaite_and_no_application_form.json rename to GetIntoTeachingApiTests/Contracts/Input/ApplyCandidateApi/sync_with_a_new_candidate_and_no_application_form.json diff --git a/GetIntoTeachingApiTests/Contracts/Output/ApplyCandidateApi/sync_with_a_new_candidaite_and_application_form.json b/GetIntoTeachingApiTests/Contracts/Output/ApplyCandidateApi/sync_with_a_new_candidate_and_application_form.json similarity index 100% rename from GetIntoTeachingApiTests/Contracts/Output/ApplyCandidateApi/sync_with_a_new_candidaite_and_application_form.json rename to GetIntoTeachingApiTests/Contracts/Output/ApplyCandidateApi/sync_with_a_new_candidate_and_application_form.json diff --git a/GetIntoTeachingApiTests/Contracts/Output/ApplyCandidateApi/sync_with_a_new_candidaite_and_no_application_form.json b/GetIntoTeachingApiTests/Contracts/Output/ApplyCandidateApi/sync_with_a_new_candidate_and_no_application_form.json similarity index 100% rename from GetIntoTeachingApiTests/Contracts/Output/ApplyCandidateApi/sync_with_a_new_candidaite_and_no_application_form.json rename to GetIntoTeachingApiTests/Contracts/Output/ApplyCandidateApi/sync_with_a_new_candidate_and_no_application_form.json diff --git a/GetIntoTeachingApiTests/GetIntoTeachingApiTests.csproj b/GetIntoTeachingApiTests/GetIntoTeachingApiTests.csproj index d3c24d76e..09e0a3c9d 100644 --- a/GetIntoTeachingApiTests/GetIntoTeachingApiTests.csproj +++ b/GetIntoTeachingApiTests/GetIntoTeachingApiTests.csproj @@ -199,10 +199,10 @@ PreserveNewest - + PreserveNewest - + PreserveNewest