@@ -16,15 +16,15 @@ def schedule_reminder(
1616 reminder : Reminder ,
1717 scheduled_time : timezone .datetime ,
1818 recurrence = ReminderSchedule .Recurrence .ONCE ,
19- ):
19+ ) -> ReminderSchedule :
2020 """Schedule a reminder."""
2121 if scheduled_time < timezone .now ():
2222 message = "Scheduled time must be in the future."
2323 raise ValidationError (message )
2424 if recurrence not in ReminderSchedule .Recurrence .values :
2525 message = "Invalid recurrence value."
2626 raise ValidationError (message )
27- ReminderSchedule .objects .create (
27+ return ReminderSchedule .objects .create (
2828 reminder = reminder ,
2929 scheduled_time = scheduled_time ,
3030 recurrence = recurrence ,
@@ -38,7 +38,7 @@ def set_reminder(
3838 minutes_before : int ,
3939 recurrence : str | None = None ,
4040 message : str = "" ,
41- ) -> Reminder :
41+ ) -> ReminderSchedule :
4242 """Set a reminder for a user."""
4343 auth = GoogleAccountAuthorization .authorize (slack_user_id )
4444 if not isinstance (auth , GoogleAccountAuthorization ):
@@ -62,16 +62,16 @@ def set_reminder(
6262 if recurrence and recurrence not in ReminderSchedule .Recurrence .values :
6363 message = "Invalid recurrence value."
6464 raise ValidationError (message )
65+ event .save ()
6566 member = Member .objects .get (slack_user_id = slack_user_id )
6667 reminder = Reminder .objects .create (
6768 channel_id = channel ,
6869 event = event ,
6970 member = member ,
7071 message = f"{ event .name } - { message } " if message else event .name ,
7172 )
72- schedule_reminder (
73+ return schedule_reminder (
7374 reminder = reminder ,
7475 scheduled_time = reminder_time ,
7576 recurrence = recurrence or ReminderSchedule .Recurrence .ONCE ,
7677 )
77- return reminder
0 commit comments