Get a user by ID with relationships preloaded.
(cls, orm: orm.Session, user_id: str | UUID)
| 135 | |
| 136 | @classmethod |
| 137 | def get_by_id(cls, orm: orm.Session, user_id: str | UUID) -> Optional['UserModel']: |
| 138 | """Get a user by ID with relationships preloaded.""" |
| 139 | return ( |
| 140 | orm.query(cls) |
| 141 | .options( |
| 142 | joinedload(cls.orgs), |
| 143 | joinedload(cls.invites), |
| 144 | ) |
| 145 | .filter(cls.id == normalize_uuid(user_id)) |
| 146 | .first() |
| 147 | ) |
| 148 | |
| 149 | |
| 150 | class OrgModel(BaseModel): |
nothing calls this directly
no test coverage detected