From e47b4de047b6b0ff6ddbc8a7bf11aa1b7200c770 Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Fri, 22 Dec 2023 13:47:27 -0500 Subject: [PATCH] fix: pass in expiry and creation date in Invite model to convert_str_to_datetime instead of expecting a datetime on init --- pyzipline/models.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pyzipline/models.py b/pyzipline/models.py index 0a8d5d0..ee7fed3 100644 --- a/pyzipline/models.py +++ b/pyzipline/models.py @@ -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)