diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..b783db0 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,55 @@ +# Contributing to Dundie Project + +Summary of project + +## Guidelines + +- Backwards compatibility. +- Multiplatform. +- Python 3 only. + +## Code of Conduct + +- Be gentle. + +## How to contribute + +### Fork repository + +- Click fork buttom on [github repository](https://github.com/vmagueta/dundie-rewards) + +### Clone to local dev environment + +```bash +git clone https://github.com/vmagueta/dundie-rewards +... +``` + +### Prepare virtual env + +```bash +cd dundie-rewards +make virtualenv +make install +``` + +### Coding style + +- This projects follows PEP8. + +### Run tests + +```bash +make test +# or +make watch +``` + +### Commit rules + +- We follow conventional commit messages. ex: `[bugfix] reason #issue` +- We required signed commits. + +### Pull Request Rulls + +- We required all tests to be passing. diff --git a/docs/how_to_install.md b/docs/how_to_install.md new file mode 100644 index 0000000..547d008 --- /dev/null +++ b/docs/how_to_install.md @@ -0,0 +1,16 @@ +# How to install + +## Official installation + +```py +pip install dundie +``` + + +## Install from source + +```bash +git clone https://github.com/vmagueta/dundie-rewards +cd dundie-rewards +make install +``` diff --git a/docs/how_to_use.md b/docs/how_to_use.md new file mode 100644 index 0000000..644811c --- /dev/null +++ b/docs/how_to_use.md @@ -0,0 +1,68 @@ +# How to use + + +## Load data + +Having a file `people.csv` with the following format: + +```csv +Jim Halpert, Sales, Salesman, jim@dundlermifflin.com +Dwight Schrute, Sales, Manager, schrute@dundlermifflin.com +Gabe Lewis, Director, Manager, glewis@dundlermifflin.com +``` + +Run `dundie load` command + +```py +dundie load people.csv +``` + +## Viewing data + +### Viewing all information + +```bash +$ dundie show + Report +┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━━━━┓ +┃ name ┃ dept ┃ role ┃ email ┃ balance ┃ last_movement ┃ +┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━━━━┩ +│ Jim Halpert │ Sales │ Salesman │ jim@dundlermif… │ 3000 │ 2022-03-15T13:… │ +│ Dwight Schrute │ Sales │ Manager │ schrute@dundle… │ 2400 │ 2022-03-15T13:… │ +│ Gabe Lewis │ Director │ Manager │ glewis@dundler… │ 500 │ 2022-03-15T13:… │ +└────────────────┴──────────┴──────────┴─────────────────┴─────────┴─────────────────┘ +``` + +### Filtering + +Available filters are `--dept` and `--email` + +```bash +dundie show --dept=Sales + Report +┏━━━━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┓ +┃ name ┃ dept ┃ role ┃ email ┃ balance ┃ last_movement ┃ +┡━━━━━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━┩ +│ Jim Halpert │ Sales │ Salesman │ jim@dundlermiff… │ 3000 │ 2022-03-15T13:44… │ +│ Dwight Schrute │ Sales │ Manager │ schrute@dundler… │ 2400 │ 2022-03-15T13:43… │ +└────────────────┴───────┴──────────┴──────────────────┴─────────┴───────────────────┘ +``` + +> **NOTE** passing `--output=file.json` will save a json file with the results. + +## Adding points + +An admin user can easily add points to any user or dept. + +```bash +dundie add 100 --email=jim@dundlermifflin.com + Report +┏━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━┓ +┃ name ┃ dept ┃ role ┃ email ┃ balance ┃ last_movement ┃ +┡━━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━┩ +│ Jim Halpert │ Sales │ Salesman │ jim@dundlermiffli… │ 3100 │ 2022-03-15T17:14:… │ +└─────────────┴───────┴──────────┴────────────────────┴─────────┴────────────────────┘ + +``` + +Available selectors are `--email` and `--dept` diff --git a/docs/index.md b/docs/index.md index 50406c2..3028b3d 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1 +1,4 @@ # Documentation for dundie + +This project offers `dundie` CLI to manage +Dunder Mifflin Reward Points. diff --git a/docs/roadmap.md b/docs/roadmap.md new file mode 100644 index 0000000..67ffd0e --- /dev/null +++ b/docs/roadmap.md @@ -0,0 +1,33 @@ +# Future plans + +Some features are not ready yet but on the roadmap for next version. + +[Issues](https://github.com/vmagueta/dundie-rewards/issues) + +## Commands + +- `load` +- `show` +- `add` +- `transfer` +- `history` + +## Password protection + +All the commands will require e-mail and password, and then will +check on the `users` table to validate the authentication. + +## Role Based Access Control + +Users that has `admin` = `True` on the `users` table will be able to +run the commands: `load`, `add` for other users access is denied. + +The `show` command will allow filtering by `dept` and `email` for admins +but for other users will default to `--email=user_email` so the user +can see only his own report. + +The `transfer` command will allow user to send points from his own account +to any other and will be password protected. + +The `history` command allow user to see his own movements, admin users can +pass `--email=` and see anyone else movements. diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..e53ed02 --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,3 @@ +site_name: Dundie Rewards CLI +theme: + name: readthedocs diff --git a/requirements.dev.txt b/requirements.dev.txt index 81a9f42..eff16be 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -7,8 +7,12 @@ pytest-watch # Code Quality flake8 pyproject-flake8 +flake8-docstrings black isort +# docs +mkdocs + # Install project as editable -e .