hspsh / whohacks

Who is at Hackerspace Pomorze?
https://whois.at.hsp.sh
GNU General Public License v3.0
13 stars 5 forks source link

Migrate db to sqlalchemy #83

Open EduKav1813 opened 2 weeks ago

EduKav1813 commented 2 weeks ago

The goal of this PR is to migrate from <Flask + peewee> to <Flask + SQLAlchemy> stack. The migration is also followed by a partial refactoring on the MVP patter (sort of), but without a presenter right now.

While I tested the setup manually, I would like to write more tests to simplify validation. Right now the PR is in the Draft phase.

Another thing is that I implemented a BitField type, and after testing I realized that it may be a misuse/overkill. It supports multiple flags, where each bit is a flag. In the current version of the application we need it to store the anonymity, which might be better implemented via Enum or something. I am not sure if we would need this BitField in the future. Please let me know in the comments.

P.S: I will also check for missing type hints and docstrings (I have to write many) later.

EduKav1813 commented 1 week ago

@not7cd I implemented everything I wanted in this PR, and I think it is ready for review. To not grow this PR any further I would focus on testing and merging this, and to implement/move any other functionality in separate PR's/issues

EduKav1813 commented 1 week ago

@not7cd Additionally, since you are much more experienced with Mikrotik, I would like to ask you to review the structure of the settings templates: whois/settings/settings_template.py. I suspect that there may be some settings in one class that may belong to the other, and while it does not makes significant practical difference, organizing them properly would help people with less domain knowledge on this matter.