feat: sqlalchemy defined orgusers relationship
This commit is contained in:
parent
d51adb4e55
commit
4ff184fe86
2 changed files with 14 additions and 0 deletions
|
|
@ -7,6 +7,7 @@ Models:
|
|||
- OrgUsers: org_id[fk][cpk], user_id[fk][cpk], is_admin
|
||||
"""
|
||||
from sqlalchemy import Column, Integer, String, ForeignKey, JSON
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
from src.database import Base
|
||||
|
||||
|
|
@ -25,6 +26,12 @@ class Organisation(Base):
|
|||
security_contact_id = Column(Integer, ForeignKey("contact.id"))
|
||||
owner_contact_id = Column(Integer, ForeignKey("contact.id"))
|
||||
|
||||
users = relationship(
|
||||
"User",
|
||||
secondary="orgusers",
|
||||
back_populates="organisations"
|
||||
)
|
||||
|
||||
|
||||
class OrgUsers(Base):
|
||||
__tablename__ = "orgusers"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue