|
@ -5,12 +5,12 @@ from typing import Tuple |
|
|
class RegistrationCode: |
|
|
class RegistrationCode: |
|
|
def __init__(self, |
|
|
def __init__(self, |
|
|
code: str, |
|
|
code: str, |
|
|
creation_time: datetime = datetime.now(), |
|
|
|
|
|
|
|
|
creation_time: datetime = None, |
|
|
expiration_time: datetime = None, |
|
|
expiration_time: datetime = None, |
|
|
usages: int = 0, |
|
|
usages: int = 0, |
|
|
max_usages: int = 1): |
|
|
max_usages: int = 1): |
|
|
self.code = code |
|
|
self.code = code |
|
|
self.creation_time = creation_time |
|
|
|
|
|
|
|
|
self.creation_time = creation_time if creation_time is not None else datetime.now() |
|
|
self.expiration_time = expiration_time |
|
|
self.expiration_time = expiration_time |
|
|
self.usages = usages |
|
|
self.usages = usages |
|
|
self.max_usages = max_usages |
|
|
self.max_usages = max_usages |
|
@ -37,10 +37,10 @@ class RegisteredUser: |
|
|
def __init__(self, |
|
|
def __init__(self, |
|
|
registration_code: str, |
|
|
registration_code: str, |
|
|
username: str, |
|
|
username: str, |
|
|
registered_time: datetime = datetime.now()): |
|
|
|
|
|
|
|
|
registered_time: datetime = None): |
|
|
self.registration_code = registration_code |
|
|
self.registration_code = registration_code |
|
|
self.username = username |
|
|
self.username = username |
|
|
self.registered_time = registered_time |
|
|
|
|
|
|
|
|
self.registered_time = registered_time if registered_time is not None else datetime.now() |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def from_db(db_registered_user: Tuple) -> 'RegisteredUser': |
|
|
def from_db(db_registered_user: Tuple) -> 'RegisteredUser': |
|
|