GitXplorerGitXplorer
h

fictional-demo-api

public
0 stars
1 forks
0 issues

Commits

List of commits on branch master.
Unverified
c511777a9681779adb5e02d041726c64d5644fd3

remove unused file

committed 3 years ago
Unverified
d4cfd54f0905fca3296f5982b11274aaa83da438

fix serializer

committed 3 years ago
Unverified
d0d302f1fec5429e85251f6c5047124a95c87d7a

Review API design document

committed 3 years ago
Unverified
3487fd6ccf988f90bbba7f641811cec1af8e441e

Fix url route, improve serialziers, test Sales per models endpoint

committed 3 years ago
Unverified
72af82073e2b2898462a2567eda878d9d6538e27

remove users and fix population

committed 3 years ago
Unverified
5a4e3d927b1e4dfd0eec016e57a09ee649159ef2

Fix model endpoint and make test for it

committed 3 years ago

README

The README file for this repository.

Fictional Motor CO system

In this document we will explain how to setup the project and work with it.

  • Set up the Docker environment
  • Launch the backend
  • Make API calls using Postman
  • Launch tests per type (unitary and non=unitary)

Also, we will introduce the ___ documentation we've build for this project

For the implementation we will combine:

  • API Model View Controller (MVC) (or MVVM Model View ViewModel)
    • Where Views are the endpoints
  • HTTP REST, especially
    • We also consider HATEOAS, #TODO json:api hyperlink but we will not implement a Level 4 maturity REST API for this prototype
  • Domain Driven Design to some degree, it is not advisable to fight the framework architecture, but we will split some domain and infrastructure out of the framework artifacts that are bound to be separated in to transversal code - specifications, common constants and libraries

Structure

. ├── config: general configuration, Django settings and urls config ├── docs │ └── diagrams ├── fictional: Django project with each context | ├── core │ ├── domain │ ├── infra │ ├── sales │ ├── users │ └── vehicles ├── scripts: scripts to set up the system ├── staticfiles └── tests: Unitary and API test

Setup

  1. Create a virtualenv
  2. Install the dependencies
pip install -r requirements.txt
  1. Delete the DB if any
rm db.sqlite
  1. Apply migrations
make apply-migrations
  1. Repopulate the database
python manage.py populate

Launch test

pytest

It should prompt code coverage and test resulta

Launch server

Simply do:

make run

The server will be available at localhost:8000 in debug mode You can use the available Postman collection and environment at docs/postman/

Documentation

Further information will be in the folder docs including:

Future work

This being a prototype, it lacks a lot of features that are advisable, both on the architecture and microcode side. To list a few:

  • Add Authenticantion

  • Add Django-Admin, to have a nice backoffice

  • Use a Filter Backend for query_params

  • Add cache

  • Add a JSON:API renderer

More endpoints

With the given domain we could easily expand our API with the following endpoints:

References

Here are the reference I used the most

Diagrams