feat: sqlalchemy defined orgusers relationship
This commit is contained in:
parent
d51adb4e55
commit
4ff184fe86
2 changed files with 14 additions and 0 deletions
|
|
@ -5,6 +5,7 @@ Models:
|
|||
- User - id[pk], email, first_name, last_name, oidc_id
|
||||
"""
|
||||
from sqlalchemy import Column, Integer, String
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
from src.database import Base
|
||||
|
||||
|
|
@ -17,3 +18,9 @@ class User(Base):
|
|||
first_name = Column(String)
|
||||
last_name = Column(String)
|
||||
oidc_id = Column(String, index=True, unique=True)
|
||||
|
||||
organisations = relationship(
|
||||
"Organisation",
|
||||
secondary="orgusers",
|
||||
back_populates="users"
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue