diff --git a/TramsDataApi.Test/FakeApi/FakeMfspApi.cs b/TramsDataApi.Test/FakeApi/FakeMfspApi.cs index 1ccaa4563..511211581 100644 --- a/TramsDataApi.Test/FakeApi/FakeMfspApi.cs +++ b/TramsDataApi.Test/FakeApi/FakeMfspApi.cs @@ -14,26 +14,29 @@ public class FakeMfspApi public void Start() { - _server = new WebHostBuilder().UseKestrel(x => x.ListenLocalhost(5003)).Configure(app => + _server = new WebHostBuilder().UseKestrel(x => x.ListenLocalhost(6784)).Configure(app => { app.Run(async context => { - if (context.Request.Method == HttpMethods.Get && context.Request.Path == "/v2/fss/projects") + if (context.Request.Method == HttpMethods.Get && context.Request.Path == "/api/v1/construct/projects") { - var response = new List() + var response = new ApiResponseV2() { - new FssProjectResponse() + Data = new List() { - CurrentFreeSchoolName = "This is my free school", - AgeRange = "5-11", - ProjectStatus = "Open", - }, - new FssProjectResponse() - { - CurrentFreeSchoolName = "This is another free school", - AgeRange = "11-16", - ProjectStatus = "Open", - }, + new FssProjectResponse() + { + CurrentFreeSchoolName = "This is my free school", + AgeRange = "5-11", + ProjectStatus = "Open", + }, + new FssProjectResponse() + { + CurrentFreeSchoolName = "This is another free school", + AgeRange = "11-16", + ProjectStatus = "Open", + }, + } }; await context.Response.WriteAsJsonAsync(response); diff --git a/TramsDataApi.Test/integration_settings.json b/TramsDataApi.Test/integration_settings.json index ac08cff66..a550761f9 100644 --- a/TramsDataApi.Test/integration_settings.json +++ b/TramsDataApi.Test/integration_settings.json @@ -12,7 +12,7 @@ "DefaultConnection": "Server=127.0.0.1,1433;Database=sip;User Id=sa;TrustServerCertificate=True;Password=StrongPassword905" }, "Mfsp": { - "ApiEndpoint": "http://localhost:5003" + "ApiEndpoint": "http://localhost:6784" }, "FeatureManagement": { "IsGetProjectsFromMfspEnabled": true diff --git a/TramsDataApi/Configuration/MfspOptions.cs b/TramsDataApi/Configuration/MfspOptions.cs index 516d58b13..e7ee8759e 100644 --- a/TramsDataApi/Configuration/MfspOptions.cs +++ b/TramsDataApi/Configuration/MfspOptions.cs @@ -3,5 +3,7 @@ public class MfspOptions { public string ApiEndpoint { get; set; } + + public string ApiKey { get; set; } } } diff --git a/TramsDataApi/Startup.cs b/TramsDataApi/Startup.cs index f555d700a..1aea3b82f 100644 --- a/TramsDataApi/Startup.cs +++ b/TramsDataApi/Startup.cs @@ -52,6 +52,7 @@ public void ConfigureServices(IServiceCollection services) { MfspOptions mfspOptions = GetTypedConfigurationFor(); client.BaseAddress = new Uri(mfspOptions.ApiEndpoint); + client.DefaultRequestHeaders.Add("ApiKey", mfspOptions.ApiKey); }); services.AddScoped(); diff --git a/TramsDataApi/TramsDataApi.csproj b/TramsDataApi/TramsDataApi.csproj index e11cde922..96add2719 100644 --- a/TramsDataApi/TramsDataApi.csproj +++ b/TramsDataApi/TramsDataApi.csproj @@ -4,6 +4,12 @@ 1ce62ee2-ff0b-4f40-9066-cfbdae2e889f true + + 1701;1702;1591 + + + 1701;1702;1591 + diff --git a/TramsDataApi/UseCases/GetAllFssProjects.cs b/TramsDataApi/UseCases/GetAllFssProjects.cs index 22d09ee46..e98ee9b9e 100644 --- a/TramsDataApi/UseCases/GetAllFssProjects.cs +++ b/TramsDataApi/UseCases/GetAllFssProjects.cs @@ -31,9 +31,9 @@ public async Task> Execute() if (useMfspApi) { - var mfspProjects = await _mfspApiClient.Get>("/v2/fss/projects"); + var mfspProjects = await _mfspApiClient.Get>("/api/v1/construct/projects"); - return mfspProjects; + return mfspProjects.Data.ToList(); } return _fssProjectGateway.GetAll().Select(fssProject => FssProjectResponseFactory.Create(fssProject)).ToList(); diff --git a/TramsDataApi/appsettings.json b/TramsDataApi/appsettings.json index 2b8962174..66233968b 100644 --- a/TramsDataApi/appsettings.json +++ b/TramsDataApi/appsettings.json @@ -39,7 +39,8 @@ } }, "Mfsp": { - "ApiEndpoint": "" + "ApiEndpoint": "", + "ApiKey": "" }, "FeatureManagement": { "IsGetProjectsFromMfspEnabled": false