-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
509 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import structlog | ||
from fastapi import APIRouter | ||
|
||
from app.deps import CurrentOrganisation, CurrentUser, DatabaseSession | ||
from app.repos import IncidentRepo | ||
from app.schemas.models import IncidentRoleSchema | ||
from app.schemas.resources import PaginatedResults | ||
|
||
logger = structlog.get_logger(logger_name=__name__) | ||
|
||
router = APIRouter(tags=["Severities"]) | ||
|
||
|
||
@router.get("/search", response_model=PaginatedResults[IncidentRoleSchema]) | ||
async def roles_search(user: CurrentUser, db: DatabaseSession, organisation: CurrentOrganisation): | ||
"""Search for all roles within the organisation""" | ||
incident_repo = IncidentRepo(session=db) | ||
|
||
roles = incident_repo.get_all_incident_roles(organisation=organisation) | ||
total = len(roles) | ||
|
||
return PaginatedResults(total=total, page=1, size=total, items=roles) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from sqlalchemy.orm import Session | ||
|
||
from app.models import Organisation | ||
from app.repos import AnnouncementRepo, IncidentRepo | ||
from app.services.events import Events | ||
from app.services.incident import IncidentService | ||
|
||
|
||
def create_incident_service( | ||
session: Session, organisation: Organisation, events: Events | None = None | ||
) -> IncidentService: | ||
"""Create a new incident service""" | ||
incident_repo = IncidentRepo(session=session) | ||
|
||
if not events: | ||
events = Events() | ||
|
||
announcement_repo = AnnouncementRepo(session=session) | ||
incident_service = IncidentService( | ||
organisation=organisation, | ||
incident_repo=incident_repo, | ||
announcement_repo=announcement_repo, | ||
events=events, | ||
) | ||
|
||
return incident_service |
Oops, something went wrong.