Skip to content

Jos-Flock/my-tomorrows-test

Repository files navigation

MyTomorrowsTest

This project was generated with Angular CLI version 16.2.1.

Development server

  • Run npm install to install al needed dependencies.
  • Run npm run prepare to install Husky.
  • Run npm run start for a dev server. Navigate to http://localhost:4200/. The application will automatically reload if you change any of the source files.

GitHub Pages

You can find this app also online at it's own gh-page. For the deploy to GitHub Pages I followed the Deploy to GitHub Pages from the Angular.io docs. The configuration can be found at gh-pages.yaml.

Scripts

npm run format

This will kick off a series of linters. This you can use during development because this makes use of the --fix and --write flags.

npm run lint

This will also kick off a series of linters. This can be used during deployment. This does not use --fix and --write flags. Instead, this only checks stuff.

npm run test

This runs jest --verbose. And basically runs al unit tests and shows the coverage. Currently the coverage is around the 95% on All files.

How does the app work?

Architectural decisions

The architecture is based on the concepts from Domain Driven Design (DDD). The core concept of this approach is to use a hexagonal architecture. The core of the application is the domain in which the business logic is applied. The data is mapped through ports and adapters to the domain model. This makes a clear separation of concerns.

General workings

The app has a couple of components which are used to display the UI. The StudyListComponent is the component which gets the Studies from his own StudyService and makes use of the StudyCardComponent to show the individual studies. It also has a button which can be used to toggle the polling timer. In the StudyCardComponent I make use of semantic HTML and the StatusComponent to convert the status to a readable text. I also make use of a MarkdownPipe to format the study.briefSummary.

StudyListComponent

The StudyListComponent has its own StudyService. This way it is possible to have multiple StudyListComponents.

StudyClient

Is the client that is responsible to handle the communication with the API. This also has a converter that internalizes the API model into the domain model. The API models are generated by OpenAPI Generator. The abstraction makes the business logic loosely coupled from the interface.

StudyService

This service is the core of the application and handles the business logic. It is responsible to keep the number of Studies to a given count. It also has the polling timer.

Explanation of decisions taken

Testing

I removed the default testing suite Karma and replaced it with Jest. I have chosen for Jest because it is more lightweight.

Linters

I made use of different linters in this project. prettier is used to format the code itself. stylelint, stylelint-config-standard-scss, stylelint-order are responsible to format all written scss. For example, it orders all css properties alphabetical. commitlint is added to make sure all the commit messages are written properly. You can override this by starting your commit message with a !. All these linters are tied together by eslint and lint-staged.

Git Hooks

I made use of husky which is a tool that makes the use of git hooks easy. It makes sure that pre-commit lint-staged is run. It also makes sure commitlint is run on the commit message itself.

Generated API models

With openapi-generator-cli I generated the API Models. I have chosen to only use the models and copy them all into the project. So at every update of the API spec only the models needed to be copied again. An alternative is to remove the generated models from the repository and let them generate at build time.

Improvements

  • Place the timer button into the NavBarComponent. This implies some extra work and you loose the ability to reuse the StudyListComponent with different settings.
  • Generated classes not in the repo.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published