Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create store for Moderator settings #1320

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft

Create store for Moderator settings #1320

wants to merge 5 commits into from

Conversation

jb3
Copy link
Member

@jb3 jb3 commented May 19, 2024

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.

Copy link

netlify bot commented May 19, 2024

Deploy Preview for pydis-static failed.

Name Link
🔨 Latest commit e6a8668
🔍 Latest deploy log https://app.netlify.com/sites/pydis-static/deploys/6652b6661eae34000817b0e4

@jchristgit
Copy link
Member

Request a review from me if this is ready for review

@jb3 jb3 force-pushed the jb3/user-props-store branch 3 times, most recently from d9ddde5 to 7f9844a Compare May 24, 2024 00:24
jb3 added 2 commits May 26, 2024 03:57
Update imports in API models to include UserModSettings

Add migration for UserModSettings model
@jchristgit jchristgit self-assigned this Jun 20, 2024
@jchristgit
Copy link
Member

Hello @jb3, what's the status with this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants