Skip to content

fdellasoppa/blexercise

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 

Repository files navigation

blexercise

User Story

I, as a Students Api user, need the ability to create, update, get one by id, get all, and delete students.

AC1: Students should have an id, Name, Address and SSN.

Setup and Run

Code: https://github.com/fdellasoppa/blexercise.git

Database: Run "docker compose up -d" on BL.Students folder. This is for the MongoDb.

In order to test the User Create:

  • Use the Login endpoint with username "administrator@localhost" and password "Passw0rd!" seeded in the code
  • After that the Create endpoint should work with authorization

In order to create a Student (I couldn't get the login to work in time):

  • Get a token with Postman with a POST at https://localhost:7237/connect/token -- Body (x-www-form-urlencoded): grant_type = client_credentials scope = api.read client_id = students client_secret = secret
  • Add this token in the Authorize section in Swagger
  • You can use the Create Student endpoint now

Steps - Thought Process

  1. Think about the Use Case, with some interesting business logic. Games or Students CRUD? Can have SSN column for some logic.

  2. Think about data storage, decided on Mongo DB as ORMs are not permitted, wondering if I could use NHibernate though (not on the list and good experience with).

  3. Start building Api

  4. Separate Api between read-only and write apis. Not needed. Only main use case vs users Apis.

  5. Considering KeyCloak or Auth0 for auth Decided to start with KeyCloak and use Authorization Code flow. As I already had a KeyCloak instance running locally on Docker.

  6. Remembered a project with IdentityServer and MongoDb as storage, this could be a faster solution. Decided on this approach as KeyCloak does not support Mongo database for backup.

  7. Searched for options with relational databases without ORMs, found Kysely. Will review in the future.

  8. Clean architecture review, created layers for IdentityServer.

  9. Finished first working version of the user create.

  10. TDD before adding password validations to the model. Added email tests even not really valid (see comment on UserTests).

  11. Test docker compose for database: Use "docker compose up -d"

  12. Following: https://www.yogihosting.com/aspnet-core-identity-mongodb/ https://www.yogihosting.com/identityserver-aspnet-core-identity-mongodb-database

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages