vbv/server/vbv_lernwelt/notify/models.py

61 lines
2.1 KiB
Python

from django.db import models
from django.utils.translation import gettext_lazy as _
from notifications.base.models import AbstractNotification
from vbv_lernwelt.course.models import CourseSession
class NotificationCategory(models.TextChoices):
USER_INTERACTION = "USER_INTERACTION", _("User Interaction")
PROGRESS = "PROGRESS", _("Progress")
INFORMATION = "INFORMATION", _("Information")
class NotificationTrigger(models.TextChoices):
ATTENDANCE_COURSE_REMINDER = (
"ATTENDANCE_COURSE_REMINDER",
_("Attendance Course Reminder"),
)
ASSIGNMENT_REMINDER = "ASSIGNMENT_REMINDER", _("Assignment Reminder")
CASEWORK_EXPERT_EVALUATION_REMINDER = (
"CASEWORK_EXPERT_EVALUATION_REMINDER",
_("Casework Expert Evaluation Reminder"),
)
CASEWORK_SUBMITTED = "CASEWORK_SUBMITTED", _("Casework Submitted")
CASEWORK_EVALUATED = "CASEWORK_EVALUATED", _("Casework Evaluated")
NEW_FEEDBACK = "NEW_FEEDBACK", _("New Feedback")
SELF_EVALUATION_FEEDBACK_REQUESTED = (
"SELF_EVALUATION_FEEDBACK_REQUESTED",
_("Self Evaluation Feedback Requested"),
)
SELF_EVALUATION_FEEDBACK_PROVIDED = (
"SELF_EVALUATION_FEEDBACK_PROVIDED",
_("Self Evaluation Feedback Provided"),
)
class Notification(AbstractNotification):
# UUIDs are not supported by the notifications app...
# id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
notification_category = models.CharField(
max_length=255,
choices=NotificationCategory.choices,
default=NotificationCategory.INFORMATION,
)
notification_trigger = models.CharField(
max_length=255,
choices=NotificationTrigger.choices,
default="",
)
target_url = models.CharField(max_length=2048, default="", blank=True)
actor_avatar_url = models.CharField(max_length=2048, default="", blank=True)
course_session = models.ForeignKey(
CourseSession, blank=True, null=True, on_delete=models.SET_NULL
)
class Meta(AbstractNotification.Meta):
abstract = False
ordering = ["-timestamp"]