2018-08-03 16:15:08 +00:00
|
|
|
from typing import Set, Union
|
|
|
|
from uuid import UUID
|
|
|
|
|
|
|
|
from sqlalchemy import Column
|
2019-01-23 15:55:04 +00:00
|
|
|
from sqlalchemy.orm import relationship
|
2018-08-03 16:15:08 +00:00
|
|
|
from sqlalchemy_utils import Password
|
|
|
|
|
2019-02-11 20:34:45 +00:00
|
|
|
from ereuse_devicehub.db import db
|
2018-08-03 16:15:08 +00:00
|
|
|
from ereuse_devicehub.resources.agent.models import Individual
|
2019-01-23 15:55:04 +00:00
|
|
|
from ereuse_devicehub.resources.inventory import Inventory
|
2018-08-03 16:15:08 +00:00
|
|
|
from ereuse_devicehub.resources.models import Thing
|
|
|
|
|
|
|
|
|
|
|
|
class User(Thing):
|
|
|
|
id = ... # type: Column
|
|
|
|
email = ... # type: Column
|
|
|
|
password = ... # type: Column
|
|
|
|
token = ... # type: Column
|
2019-01-23 15:55:04 +00:00
|
|
|
inventories = ... # type: relationship
|
2020-08-17 14:45:18 +00:00
|
|
|
ethereum_address = ... # type: Column
|
2018-08-03 16:15:08 +00:00
|
|
|
|
2019-01-23 15:55:04 +00:00
|
|
|
def __init__(self, email: str, password: str = None,
|
|
|
|
inventories: Set[Inventory] = None) -> None:
|
|
|
|
super().__init__()
|
2018-08-03 16:15:08 +00:00
|
|
|
self.id = ... # type: UUID
|
|
|
|
self.email = ... # type: str
|
|
|
|
self.password = ... # type: Password
|
|
|
|
self.individuals = ... # type: Set[Individual]
|
|
|
|
self.token = ... # type: UUID
|
2019-01-23 15:55:04 +00:00
|
|
|
self.inventories = ... # type: Set[Inventory]
|
2020-08-17 14:45:18 +00:00
|
|
|
self.ethereum_address = ... # type: str
|
2018-08-03 16:15:08 +00:00
|
|
|
|
|
|
|
@property
|
|
|
|
def individual(self) -> Union[Individual, None]:
|
|
|
|
pass
|
2019-02-11 20:34:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
class UserInventory(db.Model):
|
|
|
|
pass
|