fix: pass in expiry and creation date in Invite model to convert_str_to_datetime instead of expecting a datetime on init
This commit is contained in:
parent
8601812c95
commit
e47b4de047
1 changed files with 6 additions and 5 deletions
|
@ -1,6 +1,7 @@
|
|||
"""This is a list of all the models used in PyZipline. They are used to represent the data returned from the Zipline API."""
|
||||
from typing import List, Dict, Optional
|
||||
from datetime import datetime
|
||||
from pyzipline.utils import convert_str_to_datetime
|
||||
|
||||
|
||||
class File:
|
||||
|
@ -83,7 +84,7 @@ class Invite:
|
|||
id (int): Integer ID of the invite
|
||||
code (str): String of the invite's code
|
||||
created_at (datetime): Datetime object of when the invite was created
|
||||
expired_at (datetime): Datetime object of when the invite will expire
|
||||
expires_at (datetime): Datetime object of when the invite will expire
|
||||
used (bool): Boolean of whether the invite has been used
|
||||
created_by_id (int): Integer ID of the user who created the invite
|
||||
"""
|
||||
|
@ -91,16 +92,16 @@ class Invite:
|
|||
self,
|
||||
id: int, # pylint: disable=redefined-builtin
|
||||
code: str,
|
||||
createdAt: datetime,
|
||||
expiredAt: datetime,
|
||||
createdAt: str,
|
||||
expiresAt: str,
|
||||
used: bool,
|
||||
createdById: int,
|
||||
**kwargs
|
||||
):
|
||||
self.id = id
|
||||
self.code = code
|
||||
self.created_at = createdAt
|
||||
self.expired_at = expiredAt
|
||||
self.created_at = convert_str_to_datetime(createdAt)
|
||||
self.expires_at = convert_str_to_datetime(expiresAt)
|
||||
self.used = used
|
||||
self.created_by_id = createdById
|
||||
self.__dict__.update(kwargs)
|
||||
|
|
Loading…
Reference in a new issue