2020-08-04 23:27:13 +02:00
|
|
|
from sqlalchemy import Boolean, Column, ForeignKey, Integer, String, Float
|
|
|
|
from sqlalchemy.orm import relationship
|
|
|
|
|
2020-08-07 01:56:18 +02:00
|
|
|
from app.database import Base
|
2020-08-04 23:27:13 +02:00
|
|
|
|
|
|
|
class Service(Base):
|
|
|
|
__tablename__ = "service"
|
|
|
|
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
|
|
name = Column(String, index=True)
|
2020-08-07 01:56:18 +02:00
|
|
|
owner_id = Column(Integer, ForeignKey("user.id"), index=True)
|
2020-08-04 23:27:13 +02:00
|
|
|
is_private = Column(Boolean, default=True)
|
2020-08-07 01:56:18 +02:00
|
|
|
description = Column(String, default=None)
|
2020-08-04 23:27:13 +02:00
|
|
|
service_type = Column(Integer)
|
|
|
|
url = Column(String)
|
|
|
|
is_active = Column(Boolean, default=True, index=True)
|
|
|
|
created_unix = Column(Float)
|
2020-08-07 01:56:18 +02:00
|
|
|
updated_unix = Column(Float, default=None)
|
2020-08-04 23:27:13 +02:00
|
|
|
|
|
|
|
user = relationship("User", back_populates="service")
|
|
|
|
|
|
|
|
|
|
|
|
class User(Base):
|
|
|
|
__tablename__ = "user"
|
|
|
|
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
|
|
name = Column(String, unique=True, index=True)
|
|
|
|
full_name = Column(String, index=True)
|
|
|
|
password = Column(String)
|
2020-08-07 01:56:18 +02:00
|
|
|
is_active = Column(Boolean, index=True)
|
2020-08-04 23:27:13 +02:00
|
|
|
created_unix = Column(Float)
|
2020-08-07 01:56:18 +02:00
|
|
|
updated_unix = Column(Float, default=None)
|
|
|
|
last_login_unix = Column(Float, default=None)
|
2020-08-04 23:27:13 +02:00
|
|
|
|
|
|
|
service = relationship("Service", back_populates="user")
|
|
|
|
|