From 6d9d017c080cc680f82a2756e00fa7f5d0e30d58 Mon Sep 17 00:00:00 2001 From: Son NK <> Date: Sat, 23 May 2020 12:18:32 +0200 Subject: [PATCH] re-organize README --- README.md | 90 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 48 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index 52383326..793ce79a 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,10 @@ the following section will show a step-by-step guide on how to get your own emai [3. Contributing Guide](#contributing) +[4. API](#api) + +[5. OAuth2/OpenID Connect](#oauth) + ## General Architecture @@ -615,7 +619,49 @@ then open http://localhost:7777, you should be able to login with the following john@wick.com / password ``` -### API +### Database migration + +The database migration is handled by `alembic` + +Whenever the model changes, a new migration has to be created. + +If you have Docker installed, you can create the migration by the following script: + +```bash +sh new_migration.sh +``` + +Make sure to review the migration script before committing it. +Sometimes (very rarely though), the automatically generated script can be incorrect. + +We cannot use the local database to generate migration script as the local database doesn't use migration. +It is created via `db.create_all()` (cf `fake_data()` method). This is convenient for development and +unit tests as we don't have to wait for the migration. + +### Code structure + +The repo consists of the three following entry points: + +- wsgi.py and server.py: the webapp. +- email_handler.py: the email handler. +- cron.py: the cronjob. + +Here are the small sum-ups of the directory structures and their roles: + +- app/: main Flask app. It is structured into different packages representing different features like oauth, api, dashboard, etc. +- local_data/: contains files to facilitate the local development. They are replaced during the deployment. +- migrations/: generated by flask-migrate. Edit these files will be only edited when you spot (very rare) errors on the database migration files. +- static/: files available at `/static` url. +- templates/: contains both html and email templates. +- tests/: tests. We don't really distinguish unit, functional or integration test. A test is simply here to make sure a feature works correctly. + +The code is formatted using https://github.com/psf/black, to format the code, simply run + +``` +black . +``` + +## API SimpleLogin current API clients are Chrome/Firefox/Safari extension and mobile (iOS/Android) app. These clients rely on `API Code` for authentication. @@ -1144,49 +1190,9 @@ Output: 200 if user is upgraded successfully 4** if any error. -### Database migration -The database migration is handled by `alembic` -Whenever the model changes, a new migration has to be created. - -If you have Docker installed, you can create the migration by the following script: - -```bash -sh new_migration.sh -``` - -Make sure to review the migration script before committing it. -Sometimes (very rarely though), the automatically generated script can be incorrect. - -We cannot use the local database to generate migration script as the local database doesn't use migration. -It is created via `db.create_all()` (cf `fake_data()` method). This is convenient for development and -unit tests as we don't have to wait for the migration. - -### Code structure - -The repo consists of the three following entry points: - -- wsgi.py and server.py: the webapp. -- email_handler.py: the email handler. -- cron.py: the cronjob. - -Here are the small sum-ups of the directory structures and their roles: - -- app/: main Flask app. It is structured into different packages representing different features like oauth, api, dashboard, etc. -- local_data/: contains files to facilitate the local development. They are replaced during the deployment. -- migrations/: generated by flask-migrate. Edit these files will be only edited when you spot (very rare) errors on the database migration files. -- static/: files available at `/static` url. -- templates/: contains both html and email templates. -- tests/: tests. We don't really distinguish unit, functional or integration test. A test is simply here to make sure a feature works correctly. - -The code is formatted using https://github.com/psf/black, to format the code, simply run - -``` -black . -``` - -### OAuth flow +## OAuth SL currently supports code and implicit flow.