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."""
|
"""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 typing import List, Dict, Optional
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
from pyzipline.utils import convert_str_to_datetime
|
||||||
|
|
||||||
|
|
||||||
class File:
|
class File:
|
||||||
|
@ -83,7 +84,7 @@ class Invite:
|
||||||
id (int): Integer ID of the invite
|
id (int): Integer ID of the invite
|
||||||
code (str): String of the invite's code
|
code (str): String of the invite's code
|
||||||
created_at (datetime): Datetime object of when the invite was created
|
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
|
used (bool): Boolean of whether the invite has been used
|
||||||
created_by_id (int): Integer ID of the user who created the invite
|
created_by_id (int): Integer ID of the user who created the invite
|
||||||
"""
|
"""
|
||||||
|
@ -91,16 +92,16 @@ class Invite:
|
||||||
self,
|
self,
|
||||||
id: int, # pylint: disable=redefined-builtin
|
id: int, # pylint: disable=redefined-builtin
|
||||||
code: str,
|
code: str,
|
||||||
createdAt: datetime,
|
createdAt: str,
|
||||||
expiredAt: datetime,
|
expiresAt: str,
|
||||||
used: bool,
|
used: bool,
|
||||||
createdById: int,
|
createdById: int,
|
||||||
**kwargs
|
**kwargs
|
||||||
):
|
):
|
||||||
self.id = id
|
self.id = id
|
||||||
self.code = code
|
self.code = code
|
||||||
self.created_at = createdAt
|
self.created_at = convert_str_to_datetime(createdAt)
|
||||||
self.expired_at = expiredAt
|
self.expires_at = convert_str_to_datetime(expiresAt)
|
||||||
self.used = used
|
self.used = used
|
||||||
self.created_by_id = createdById
|
self.created_by_id = createdById
|
||||||
self.__dict__.update(kwargs)
|
self.__dict__.update(kwargs)
|
||||||
|
|
Loading…
Reference in a new issue