@@ -159,7 +159,7 @@ class Availability(AvailabilityBase):
159159
160160
161161class ScheduleBase (BaseModel ):
162- model_config = ConfigDict (json_encoders = { time : lambda t : t .strftime ('%H:%M' ) })
162+ model_config = ConfigDict (json_encoders = { time : lambda t : t .strftime ('%H:%M' )})
163163
164164 active : bool | None = True
165165 name : str = Field (min_length = 1 , max_length = 128 )
@@ -195,7 +195,7 @@ class ScheduleValidationIn(ScheduleBase):
195195 """ScheduleBase but with specific fields overridden to add validation."""
196196
197197 # Regex to exclude any character can be mess with a url
198- slug : Annotated [Optional [str ], Field (min_length = 2 , max_length = 16 , pattern = r" ^[^\;\/\?\:\@\&\=\+\$\,\#]*$" )] = None
198+ slug : Annotated [Optional [str ], Field (min_length = 2 , max_length = 16 , pattern = r' ^[^\;\/\?\:\@\&\=\+\$\,\#]*$' )] = None
199199 slot_duration : Annotated [int , Field (ge = 10 , default = 30 )]
200200 # Require these fields
201201 start_date : date
@@ -211,29 +211,26 @@ def start_time_should_be_before_end_time(self) -> Self:
211211 # Fallback to utc...
212212 tz = self .timezone or 'UTC'
213213
214- start_time = datetime .combine (
215- self .start_date ,
216- self .start_time ,
217- tzinfo = timezone .utc ).astimezone (zoneinfo .ZoneInfo (tz )
214+ start_time = datetime .combine (self .start_date , self .start_time , tzinfo = timezone .utc ).astimezone (
215+ zoneinfo .ZoneInfo (tz )
218216 )
219217
220- end_time = datetime .combine (
221- self .start_date ,
222- self .end_time ,
223- tzinfo = timezone .utc ).astimezone (zoneinfo .ZoneInfo (tz )
218+ end_time = datetime .combine (self .start_date , self .end_time , tzinfo = timezone .utc ).astimezone (
219+ zoneinfo .ZoneInfo (tz )
224220 )
225221
226- start_time = ( start_time + timedelta (minutes = self .slot_duration ) )
222+ start_time = start_time + timedelta (minutes = self .slot_duration )
227223 end_time = end_time
228224 # Compare time objects!
229225 if start_time .time () > end_time .time ():
230226 msg = l10n ('error-minimum-value' )
231227
232228 # These can't be field or value because that will auto-format the msg? Weird feature but okay.
233- raise PydanticCustomError (defines .END_TIME_BEFORE_START_TIME_ERR , msg , {
234- 'err_field' : 'end_time' ,
235- 'err_value' : start_time .astimezone (timezone .utc ).time ()
236- })
229+ raise PydanticCustomError (
230+ defines .END_TIME_BEFORE_START_TIME_ERR ,
231+ msg ,
232+ {'err_field' : 'end_time' , 'err_value' : start_time .astimezone (timezone .utc ).time ()},
233+ )
237234
238235 return self
239236
@@ -286,6 +283,8 @@ class CalendarOut(CalendarBase):
286283
287284
288285class Invite (BaseModel ):
286+ model_config = ConfigDict (from_attributes = True )
287+
289288 subscriber_id : int | None = None
290289 owner_id : Optional [int ] = None
291290 code : str
@@ -339,14 +338,38 @@ class SubscriberMeOut(SubscriberBase):
339338 schedule_links : list [str ] = []
340339
341340
342- class SubscriberAdminOut (Subscriber ):
341+ class SubscriberAdminItem (Subscriber ):
343342 model_config = ConfigDict (from_attributes = True )
344343
345344 invite : Invite | None = None
346345 time_created : datetime
347346 time_deleted : datetime | None
348347
349348
349+ class Paginator (BaseModel ):
350+ page : int
351+ total_pages : int
352+ count : int
353+ per_page : int
354+
355+
356+ class ListResponse (BaseModel ):
357+ items : list
358+ page_meta : Paginator
359+
360+
361+ class SubscriberAdminOut (ListResponse ):
362+ items : list [SubscriberAdminItem ]
363+
364+
365+ class ListResponseIn (BaseModel ):
366+ page : int = 1
367+ per_page : int = 50
368+
369+
370+ class InviteAdminOut (ListResponse ):
371+ items : list [Invite ]
372+
350373""" other schemas used for requests or data migration
351374"""
352375
@@ -471,7 +494,7 @@ class WaitingListInviteAdminOut(BaseModel):
471494 errors : list [str ]
472495
473496
474- class WaitingListAdminOut (BaseModel ):
497+ class WaitingListAdminOutItem (BaseModel ):
475498 model_config = ConfigDict (from_attributes = True )
476499
477500 id : int
@@ -484,6 +507,10 @@ class WaitingListAdminOut(BaseModel):
484507 invite : Invite | None = None
485508
486509
510+ class WaitingListAdminOut (ListResponse ):
511+ items : list [WaitingListAdminOutItem ]
512+
513+
487514class PageLoadIn (BaseModel ):
488515 browser : Optional [str ] = None
489516 browser_version : Optional [str ] = None
0 commit comments