-
Notifications
You must be signed in to change notification settings - Fork 1
Develop/feature/td 5829 introduce and integrate a shared project into the lh solution #1275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… into as first code to become shared.
/// that secure or private configuration data is not inadvertently exposed to clients. | ||
/// </para> | ||
/// </summary> | ||
public class PublicSettings : IPublicSettings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If Settings was broken up into more classes/objs in the appsettings we could inject just the bits we are using, -> least knowledge and interface segregation. But I expect there would be alot involved in doing this so I am expect appsetting will stay the same and we will inject PublicSettings and have PublicX per obj, (public may be the wrong word choice).
{ | ||
using LearningHub.Nhs.Models.Enums; | ||
using Microsoft.AspNetCore.Mvc.Rendering; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are not using this, it is only for comments here, i think we shouldnt include it. Or use System.X libraries so we don't pull through unneeded dependencies which arn't support in blazor for example, but generally more generic, more framework-neutral options are better for compatibility.
/// </summary> | ||
public string LearningHubApiUrl { get; set; } | ||
|
||
public IFindwiseSettingsPublic FindwiseSettings { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is so we map the reduced FindwiseSettings and get just what we have defined as safe. My preference would be not putting PublicSettings into SearchService but inject two separate interface with just the information it needs. this may not be correct.
/// <summary> | ||
/// Gets the base URL of the API. | ||
/// </summary> | ||
string ApiUrl { get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other versions of this functionality in other project dont have APIUrl this comes from the baseHttpClient
/// The abstract api http client. | ||
/// </summary> | ||
public abstract class BaseHttpClient | ||
public abstract class BaseHttpClient : IAPIHttpClient |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will allow blazor to inject clients into services in the same way MVC does by using the interface.
6ac95a8
to
32ab570
Compare
JIRA link
TD-5829
Description
I've created a Shared Project. This project is for the purpose of sharing coding across project in the solution and is intended to in future be used instead of internal model packages. Changes should not affect the App but should allow and encourage future development to share more code resources across projects. It should also ultimately reduce duplication in the code base.
Interface are used, including marker interfaces, for specifying configurations of services being injected, and to allow injected services to be providers for multiple more specific interfaces enabling services to have less knowledge and access to methods and data they do not use.
Settings and other configuration are being split with an interface whilst maintain the current appsettings structure. This is so if only non secure data is needed in a service then only that is injected, which also supports it being useable clientside safely.
E.g. Something like:
It seems alot of files have been moved but this is due to them all being connected to the SearchService.
I've included in the Shared Project
But I assume ultimately we would migrate from it to shared but that it would not be achievable to start without it.
I recommending starting with the Shared SearchService, then PublicSettings, then HttpClients
Several recommendations and points of discussions come from this task.
Screenshots
NA
Developer checks
(Leave tasks unticked if they haven't been appropriate for your ticket.)
I have:
Either:
Or: