Skip to content

Commit

Permalink
Add Docs and MKDocs (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
vmagueta authored Jul 1, 2024
1 parent 85b66ae commit 3bca4ed
Show file tree
Hide file tree
Showing 7 changed files with 182 additions and 0 deletions.
55 changes: 55 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -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.
16 changes: 16 additions & 0 deletions docs/how_to_install.md
Original file line number Diff line number Diff line change
@@ -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
```
68 changes: 68 additions & 0 deletions docs/how_to_use.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# How to use


## Load data

Having a file `people.csv` with the following format:

```csv
Jim Halpert, Sales, Salesman, [email protected]
Dwight Schrute, Sales, Manager, [email protected]
Gabe Lewis, Director, Manager, [email protected]
```

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 protected]
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`
3 changes: 3 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# Documentation for dundie

This project offers `dundie` CLI to manage
Dunder Mifflin Reward Points.
33 changes: 33 additions & 0 deletions docs/roadmap.md
Original file line number Diff line number Diff line change
@@ -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.
3 changes: 3 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
site_name: Dundie Rewards CLI
theme:
name: readthedocs
4 changes: 4 additions & 0 deletions requirements.dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ pytest-watch
# Code Quality
flake8
pyproject-flake8
flake8-docstrings
black
isort

# docs
mkdocs

# Install project as editable
-e .

0 comments on commit 3bca4ed

Please sign in to comment.