This repository has been archived on 2020-08-14. You can view files and clone it, but cannot push or open issues or pull requests.
statuspage/app/models.py
surtur 2dd2258472
feat: {user,service} {creation,deletion,listing}
* also updated requirements.txt accordingly
2020-08-04 23:27:13 +02:00

36 lines
1.0 KiB
Python

from sqlalchemy import Boolean, Column, ForeignKey, Integer, String, Float
from sqlalchemy.orm import relationship
from .database import Base
class Service(Base):
__tablename__ = "service"
id = Column(Integer, primary_key=True, index=True)
name = Column(String, index=True)
is_private = Column(Boolean, default=True)
description = Column(String)
service_type = Column(Integer)
url = Column(String)
owner_id = Column(Integer, ForeignKey("user.id"), index=True)
is_active = Column(Boolean, default=True, index=True)
created_unix = Column(Float)
updated_unix = Column(Float)
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)
is_active = Column(Boolean, default=True, index=True)
created_unix = Column(Float)
last_login_unix = Column(Float)
service = relationship("Service", back_populates="user")