feat: org id in get user/self/db
This commit is contained in:
parent
6aad2e560f
commit
bb4965ab07
2 changed files with 22 additions and 26 deletions
|
|
@ -27,19 +27,15 @@ class User(Base):
|
|||
oidc_id = Column(String, index=True, unique=True)
|
||||
|
||||
organisation_rel = relationship(
|
||||
"Organisation",
|
||||
secondary="orgusers",
|
||||
back_populates="user_rel"
|
||||
"Organisation", secondary="orgusers", back_populates="user_rel"
|
||||
)
|
||||
|
||||
@property
|
||||
def organisations(self):
|
||||
return [org.name for org in self.organisation_rel]
|
||||
return [{"name": org.name, "id": org.id} for org in self.organisation_rel]
|
||||
|
||||
group_rel = relationship(
|
||||
"Group",
|
||||
secondary="user_groups",
|
||||
back_populates="user_rel"
|
||||
"Group", secondary="user_groups", back_populates="user_rel"
|
||||
)
|
||||
|
||||
@property
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class UserResponse(CustomBaseModel):
|
|||
first_name: str
|
||||
last_name: str
|
||||
email: str
|
||||
organisations: list[Optional[str]]
|
||||
organisations: list[Optional[dict[str, str|int]]]
|
||||
groups: Optional[dict[str, list[str]]] = None
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue