diff options
author | 2019-01-22 23:30:15 +0100 | |
---|---|---|
committer | 2019-01-22 23:30:15 +0100 | |
commit | 475b3bcd51d5e016dcc3830d49000dda852264a7 (patch) | |
tree | db1d6761af3e4939746a037c482c22b22e09dd15 /api/models.py | |
parent | Chonk down horrible JOIN performance. (diff) |
Add an API endpoint for reminders.
Diffstat (limited to 'api/models.py')
-rw-r--r-- | api/models.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/api/models.py b/api/models.py index 6dce0eb4..5ca274ce 100644 --- a/api/models.py +++ b/api/models.py @@ -369,3 +369,42 @@ class Infraction(ModelReprMixin, models.Model): if self.hidden: s += " (hidden)" return s + + +class Reminder(ModelReprMixin, models.Model): + """A reminder created by a user.""" + + active = models.BooleanField( + default=True, + help_text=( + "Whether this reminder is still active. " + "If not, it has been sent out to the user." + ) + ) + author = models.ForeignKey( + User, + on_delete=models.CASCADE, + help_text="The creator of this reminder." + ) + channel_id = models.BigIntegerField( + help_text=( + "The channel ID that this message was " + "sent in, taken from Discord." + ), + validators=( + MinValueValidator( + limit_value=0, + message="Channel IDs cannot be negative." + ), + ) + ) + content = models.CharField( + max_length=1500, + help_text="The content that the user wants to be reminded of." + ) + expiration = models.DateTimeField( + help_text="When this reminder should be sent." + ) + + def __str__(self): + return f"{self.content} on {self.expiration} by {self.author}" |