ineshbose / boyd_bot_messenger

Boyd Bot (Flask Version)
https://inesh.xyz/boyd_bot_messenger
MIT License
6 stars 3 forks source link

Database Modularity #12

Open ineshbose opened 4 years ago

ineshbose commented 4 years ago

The class Database implemented in services.py isn't as modular as it's intended to be. As of release 1.10.0, this project uses pymongo which is a NoSQL DB that easily stores dictionary / key-values in the database. However, there may be difficulties to alter the class for say, redis. Therefore, the class needs refactoring.

Each tuple has 3 attributes - _id (primary key), uni_id and uni_pw. However, in-registration users will rather have _id and reg_id.

ineshbose commented 4 years ago

Change primary key for in-registration users to reg_id. Redis uses hset() for key-value. Using this also may mean to use decode_responses=True.

ineshbose commented 4 years ago

Created a sanitize function for database that would turn dataset into a dictionary and also took advantage of kwargs.

Modularity yet to be tested by shifting to redis.