This is a basic python(flask) CRUD app that uses sqlite. It serves up the API endpoints and the static html that runs our dndonations logging system
To get the development environment up and running you need docker installed.
- Do some editing
- Rebuild the container with the command
docker build . -t dndapi
- Run the newly built container:
docker run -it -p 8080:8080 -v ${PWD}/development.db:/data/sqlite.db dndapi
This binds to port 8080 to serve up the web frontend and mounts a development database file. - Point your browser to
http://localhost:8080/
to see your changes in action.
The terminal output should show python logging info, and the browser developer console shows the javascript related debug info.
__init__.py
: This kicks off the webserver.auth.py
: This handles the authentication. we are using JWT to do the API authdatabase.py
: This is the database controller. it contains all of the sqlite3 codeendpoints/*.py
: These run all of the api endpoints. They are separated out by function
+------------------------------+ +-------------------------+
|Donors | |Characters |
+------------------------------+ +-------------------------+
|id INTEGER pkey +<-+-+-+ |id INTEGER pkey <--+
|first_name TEXT | | | | |name TEXT UNIQUE | |
|last_name TEXT | | | | |race TEXT | |
|physical_address TEXT | | | | |class TEXT | |
|dci_number TEXT | | | | |state TEXT | |
+------------------------------+ | | | |num_resses INTEGER | |
| | +---+player_id INTEGER | |
+-----------------------+ | | |start_time TIMESTAMP | |
|Donations | | | |end_time TIMESTAMP | |
+-----------------------+ | | +-------------------------+ |
|id INTEGER pkey | | | |
|timestamp TIMESTAMP | | | +-------------------------+ |
|amount INTEGER | | | |Queue | |
|method TEXT | | | | | |
|donor_id INTEGER +---------+ | |id INTEGER pkey| |
+-----------------------+ | |position INTEGER | |
| |character_id INTEGER +--+
+------------------------+ | +-------------------------+
|Purchases | |
+------------------------+ | +-----------------------+
|id INTEGER pkey | | |Dms |
|timestamp TIMESTAMP | | +-----------------------+
|amount INTEGER | | |id INTEGER pkey |
|reason TEXT | | |name TEXT |
|donor_id INTEGER +----------+ |team TEXT |
+------------------------+ |numkills INTEGER |
|current INTEGER |
+-----------------------+