This is a system developed to record billing information of LCMWS clients.
It aims to have a central database for all the records and a way to access them.
The project runs of flask and depends on other packages as well. The packages are in the requirements file.
pip install -r requirements.txt
There are 2 main parts:
- Administrator Section
- Meter Reader Section
The previledges of the admin are:
- Add a user (Admin, Reader or Client)
- View all clients in the system, plus their bills
The Reader can only add the current meter reading of the client
The database stores four tables. The admin, reader, client and bill tables.
The reader and client tables have a relationship with the bill table to store which client the bill belongs to and which user added the bill to the system.
Also the is_administrator, is_red and is_adred functions are added to help in route protection; namely administrator only, reader only, and administrator and reader routes respectively.
Remember to have all the enviroment variables declared before hand as they are needed in creation of the app
The environment variables needed are:
- SQLALCHEMY_DATABASE_URI
- SECRET_KEY
- ROOT_ID
Initialize the database as follows
In the virtual environment run the following commands:
flask shell
from src.models import db, Admin
from werkzeug.security import generate_password_hash
db.create_all()
password = generate_password_hash('123')
admin = Admin('admin', password)
db.session.add(admin)
db.session.commit()
The above initializes the tables in the already created database. Also the root admin is set at this instance. The id of the root admin is set as an environment variable.
Only after all environment variables are set, is when the application can be ran.
There is a Dockerfile and docker-compose file for running the application in a container
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.