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:
[ ] Create a new model to store settings in
[ ] Update serializers to be compatible with serializing this new field
[ ] Update viewsets to allow this field to be returned optionally, saving
processing time when it is not needed
[ ] Add new routes for the bot to PATCH data to this endpoint to update a
moderators settings
[ ] Write new tests for models and routes
Any input from those wiser with Django than me would be appreciated to
maximimise the optimisation of these endpoints and models.
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.