isp_model.py 1.5 KB

1234567891011121314151617181920212223242526272829303132
  1. from sqlalchemy import JSON, Sequence, Column, Integer, String,ForeignKey,Boolean
  2. import persistence
  3. __db_Base = persistence.get_db_base()
  4. class isp(__db_Base) :
  5. __tablename__ = 'tIsp'
  6. id = Column(Integer, Sequence('isp_id_seq'), primary_key=True,nullable=False)
  7. name = Column(String(50))
  8. description = Column(String(500))
  9. class user_account(__db_Base) :
  10. __tablename__ = 'tUser_accounts'
  11. id = Column(Integer, Sequence('user_accounts_id_seq'), primary_key=True,nullable=False)
  12. nickname = Column(String(50), primary_key=True, nullable=False)
  13. description = Column(String(500))
  14. password = Column(String)
  15. is_super_admin = Column(Boolean, default=False)
  16. custom_data = Column(JSON)
  17. privileges_data = Column(JSON)
  18. # for privilege we can use an int in the used as a bitset later for an array of privilege
  19. class user_account_isp_link(__db_Base):
  20. __tablename__ = 'tUser_account_isp_links'
  21. link_id = Column(Integer, Sequence('tUser_account_isp_links_seq'), primary_key=True,nullable=False)
  22. user_account_id = Column(Integer, ForeignKey('tUser_accounts.id'))
  23. isp_id = Column(Integer, ForeignKey('tIsp.id'))
  24. note = Column(String(500))
  25. contact_mail = Column(String(100))
  26. contact_number = Column(String(100))