feat: condensed user get endpoints
The process also added improved ORM relationships for multiple models.
This commit is contained in:
parent
4ff184fe86
commit
a80767d870
5 changed files with 39 additions and 65 deletions
|
|
@ -6,6 +6,7 @@ Models:
|
|||
- Models: Description
|
||||
"""
|
||||
from sqlalchemy import Column, Integer, String, ForeignKey, UniqueConstraint
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
from src.database import Base
|
||||
|
||||
|
|
@ -29,6 +30,14 @@ class Group(Base):
|
|||
|
||||
org_id = Column(Integer, ForeignKey("organisation.id", ondelete="CASCADE"))
|
||||
|
||||
user_rel = relationship(
|
||||
"User",
|
||||
secondary="user_groups",
|
||||
back_populates="group_rel"
|
||||
)
|
||||
|
||||
org_rel = relationship("Organisation", back_populates="group_rel")
|
||||
|
||||
|
||||
class GroupPermissions(Base):
|
||||
__tablename__ = "group_permissions"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue