Get a hosting project by ID with project and org relationships preloaded.
(cls, session: orm.Session, project_id: str | UUID)
| 77 | |
| 78 | @classmethod |
| 79 | def get_by_id(cls, session: orm.Session, project_id: str | UUID) -> Optional[HostingProjectModel]: |
| 80 | """Get a hosting project by ID with project and org relationships preloaded.""" |
| 81 | from agentops.opsboard.models import ProjectModel |
| 82 | |
| 83 | return ( |
| 84 | session.query(cls) |
| 85 | .filter(cls.id == normalize_uuid(project_id)) |
| 86 | .options(joinedload(cls.project).joinedload(ProjectModel.org)) |
| 87 | .first() |
| 88 | ) |
| 89 | |
| 90 | @classmethod |
| 91 | def get_or_create_by_id(cls, session: orm.Session, project_id: str | UUID) -> HostingProjectModel: |
no test coverage detected