otriples.portal's People
Forkers
jaafghan woaksie sadhat sujeet07 stasnowak arielcortez kipackjeong tajwal pmalik8 magicianred smilexlong evannlim meirkr mehdi-aghaei 73kendo cjdutoit brianlparker ysnarafat coeur85 sallydeveloper rcruzfreelance arafat-pro talatmorshedtanbir gongoozledgeek appsolab nivlas deepshri7 kfitz114 devanteconnor jgoschke pacohams navjot1983 imjane5 lohithgn zmurodov jdiss andrewmassart chrislangston lgbengs kirubel2022 eusme glhays douhapyotriples.portal's Issues
BROKERS: GET All Teachers
CONFIG: Update .NET version to 7.0.100-preview.1.22110.4
FOUNDATIONS: Retrieve All Teachers
PAGE: Render All Teacher Views Component
CODE RUB: Move Api Configurations to Api Broker and out of Startup.cs
Look up how we setup API broker in Taarafo.Web
FOUNDATIONS: Retrieve All Courses
CODE RUB: Some thoughts from watching https://www.youtube.com/watch?v=5Htj8JFglb4
Interesting Hassan.
Whilst following your guide video I couldn't see what ApiBroker did beyond providing some sort of wrapper around a HttpClient instance. My initial thoughts were ... could he not just use HttpClient directly?
That got me thinking, most API's (like mine) are built to a standard like OData so some common extensions might be all that's needed, or did I miss something?
I would do something like this ...
public static class HttpClientExtensions
{
ILogger log;
static HttpClientExtensions(ILogger log) => this.log = log;
public static async Task<Token> Authenticate(this HttpClient client, string user, string pass)
{
try
{
var auth = new { User = user, Pass = pass };
var payload = new StringContent(auth.ToJsonForOdata(), Encoding.UTF8, "application/json");
var response = await client.PostAsync("Account/Login", payload);
response.EnsureSuccessStatusCode();
var token = await response.Content.ReadAsAsync<Token>();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("bearer", token.Id);
return token;
}
catch { /* if we get here the server returned a json repsonse but it wasn't a token, it was more than likely an auth failure. */ }
log.Warn("Auth request Failed for user " + user);
return null;
}
public static Task<ODataCollection<T>> GetODataCollection(this HttpClient client, string query)
=> client.GetAsync(query)
.ContinueWith(async t => await t.Result.Content.ReadAsAsync<ODataCollection<T>>())
.Unwrap();
}
Then in my "broker consuming" code ...
var api = new HttpClient("base url");
await api.Authenticate("user", "pass");
var someFoos = (await api.GetODataCollection<Foo>("Foo?filter= ...")).ToArray();
Unless there's some function beyond this wrapper function for Brokers you could remove that layer altogether.
I did then noticed that you built a "LoggingBroker", would inject as a dependency an Ilogger instance through the usual mechanisms and if need be build my own ILogger structure that uses a http client within it as logging is something that happens literally everywhere in an application.
CODE RUB: Rename Brokers/Logging to Brokers/Loggings
BROKERS: Get All Teachers
Assigned to @shivangsoni
BROKERS: GET All Classrooms
Learn about Brokers here:
https://github.com/hassanhabib/The-Standard/blob/master/1.%20Brokers/1.%20Brokers.md#1-brokers
Here's some examples:
#19
CONFIG: Upgrade Pipelines to .NET 6.0.100
Here's an example:
hassanhabib/OtripleS#764
CODE RUB: Upgrade to New Xeption Testing Standard
For reference:
https://www.youtube.com/watch?v=AlBq-3_EXb0&t=1728s
DISCUSSION: Dependency Inversion Principle Violation
Hi all,
Abstractions should not depend on details.
Here we're violating this by using the concrete implementation of the collection interface.
If in the concrete implementations we change List to something else that implements the same interface our contract would need to change. So we are strongly coupled.
For instance:
public partial interface IApiBroker
{
ValueTask<List<Teacher>> GetAllTeachersAsync();
}
public interface ITeacherService
{
ValueTask<List<Teacher>> RetrieveAllTeachersAsync();
}
Instead we should move to the abstraction and in the underlying implementations, if we need some concrete implementation, we can use it.
One reasonable choice would be IEnumerable. That's okay.
But, on the other side I believe that the data that we consume from other services/APIs should not be changeable.
Therefore we could use IReadOnlyCollection and enforce that collections are not changed.
I know that we can again change the underlying props of the collection objects but that's a different story.
What's your opinion on this?
CODE RUB: Update Libraries
CODE RUB: Unit Test of Teacher View Service to new Standard
Rewrite Unit Test of Retrieve All Teacher Views to fit the Standard like in #44
VIEWS: Retrieve All Teacher Views
CODE RUB: Rename Brokers/API to Brokers/Apis
BROKERS: GET All Courses
Learn about Brokers here:
https://github.com/hassanhabib/The-Standard/blob/master/1.%20Brokers/1.%20Brokers.md#1-brokers
Here's some examples:
#19
CONFIG: Update .NET Version to 6.0.101
BROKERS: GET All Users
COMPONENTS: Render All Teacher Views
PROVISION: Initialize Azure Resources for Blazor Project
Here's some videos to help you understand the task:
https://www.youtube.com/watch?v=ht0xhQyF1x4
https://www.youtube.com/watch?v=E67QyXV_-v8&list=PLan3SCnsISTQ63o4HFkIw0YcEcOlwqt53&index=6
https://www.youtube.com/watch?v=96tl4f1gfa4&list=PLan3SCnsISTQ63o4HFkIw0YcEcOlwqt53&index=7
https://www.youtube.com/watch?v=sOje4-6psEY&list=PLan3SCnsISTQ63o4HFkIw0YcEcOlwqt53&index=8
https://www.youtube.com/watch?v=mryQEZIQqmA&list=PLan3SCnsISTQ63o4HFkIw0YcEcOlwqt53&index=9
BROKERS: GET All Courses
BROKERS: GET All Assignments
BASE: Grid For All Data Types (Generic)
FOUNDATIONS: Retrieve All Students
BROKERS: GET All Classes
Complete structure according to Standard Separation
I am very interested in OtripleS project and clean architecture standard which you have exaplained but only have one question Why OtripleS Project dosn’t include all layers according to standard like domain , application , infrastructure and UI to have complete structure according to standard clean architecture.
VIEWS: Retrieve All Students Views
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.