python-discord / site

pythondiscord.com - A Django and Bulma web application.
https://pythondiscord.com
MIT License
638 stars 127 forks source link

Create store for Moderator settings #1320

Open jb3 opened 1 month ago

jb3 commented 1 month ago

This PR introduces a UserModSettings model to store properties related to moderator preference that we currently store in Redis. This is part of a wider scale effort to migrate away from Redis any data which would be anything more than slightly annoying in the event it gets lost.

This will require bot side changes but it is not a breaking change to merge this when it is ready. Some manual migration will be required to move the current moderator settings from Redis into this new PostgreSQL table.

I have added a basic copy of the cache data that we use on Redis, adding some constraints to ensure that we do not end up retaining partially valid data (i.e. a moderator schedule that has a start time but no duration).

Tasks required for this PR:

Any input from those wiser with Django than me would be appreciated to maximimise the optimisation of these endpoints and models.

netlify[bot] commented 1 month ago

Deploy Preview for pydis-static failed.

Name Link
Latest commit e6a866845bd2a017b69fedfc1e6aefc0784a7e7b
Latest deploy log https://app.netlify.com/sites/pydis-static/deploys/6652b6661eae34000817b0e4
jchristgit commented 1 month ago

Request a review from me if this is ready for review