minor: cleanup
Minor tweaks to reduce warnings in IDE e.g. unused imports.
This commit is contained in:
parent
d89c926a38
commit
f54876eac6
7 changed files with 10 additions and 15 deletions
|
|
@ -9,18 +9,13 @@ from typing import Annotated
|
||||||
|
|
||||||
from fastapi import APIRouter, HTTPException
|
from fastapi import APIRouter, HTTPException
|
||||||
from fastapi.params import Path
|
from fastapi.params import Path
|
||||||
from sqlalchemy.sql import exists
|
|
||||||
|
|
||||||
from src.organisation.constants import ContactType
|
from src.organisation.constants import ContactType
|
||||||
from src.organisation.schemas import OrgContactGetResponse
|
from src.organisation.schemas import OrgContactGetResponse
|
||||||
from src.organisation.models import Organisation as Org
|
from src.organisation.models import Organisation as Org
|
||||||
from src.contact.models import Contact
|
from src.contact.models import Contact
|
||||||
from src.user.models import User
|
|
||||||
from src.user.schemas import UserResponse, OIDCUser, OrgResponse
|
|
||||||
|
|
||||||
from src.organisation.models import OrgUsers, Organisation
|
from src.auth.service import claims_dependency, org_or_super_admin_dependency
|
||||||
|
|
||||||
from src.auth.service import claims_dependency, org_user_dependency, org_admin_dependency
|
|
||||||
from src.database import db_dependency
|
from src.database import db_dependency
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -31,7 +26,7 @@ router = APIRouter(
|
||||||
|
|
||||||
|
|
||||||
@router.get("/{org_id}/contact/{contact_type}", response_model=OrgContactGetResponse)
|
@router.get("/{org_id}/contact/{contact_type}", response_model=OrgContactGetResponse)
|
||||||
async def get_contact(db: db_dependency, user: claims_dependency, is_admin: org_user_dependency, contact_type: ContactType, org_id: Annotated[int, Path(gt=0)]):
|
async def get_contact(db: db_dependency, user: claims_dependency, is_admin: org_or_super_admin_dependency, contact_type: ContactType, org_id: Annotated[int, Path(gt=0)]):
|
||||||
org_model = db.query(Org).filter(Org.id == org_id).first()
|
org_model = db.query(Org).filter(Org.id == org_id).first()
|
||||||
if org_model is None:
|
if org_model is None:
|
||||||
raise HTTPException(status_code=404, detail="Organisation not found")
|
raise HTTPException(status_code=404, detail="Organisation not found")
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ Models:
|
||||||
"""
|
"""
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from pydantic import Field, EmailStr
|
from pydantic import EmailStr
|
||||||
|
|
||||||
from src.organisation.constants import ContactType
|
from src.organisation.constants import ContactType
|
||||||
from src.schemas import CustomBaseModel
|
from src.schemas import CustomBaseModel
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,11 @@ app = FastAPI(
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Type inspection disabled for middleware injection.
|
||||||
|
# Known bug in FastAPI type checking: https://github.com/astral-sh/ty/issues/1635
|
||||||
|
# noinspection PyTypeChecker
|
||||||
app.add_middleware(SessionMiddleware, secret_key=settings.SECRET_KEY.get_secret_value())
|
app.add_middleware(SessionMiddleware, secret_key=settings.SECRET_KEY.get_secret_value())
|
||||||
|
# noinspection PyTypeChecker
|
||||||
app.add_middleware(
|
app.add_middleware(
|
||||||
CORSMiddleware,
|
CORSMiddleware,
|
||||||
allow_origins=settings.CORS_ORIGINS,
|
allow_origins=settings.CORS_ORIGINS,
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,6 @@ Models:
|
||||||
from sqlalchemy import Column, Integer, String, Boolean, ForeignKey, JSON, false
|
from sqlalchemy import Column, Integer, String, Boolean, ForeignKey, JSON, false
|
||||||
|
|
||||||
from src.database import Base
|
from src.database import Base
|
||||||
from src.contact.models import Contact
|
|
||||||
from src.user.models import User
|
|
||||||
|
|
||||||
|
|
||||||
class Organisation(Base):
|
class Organisation(Base):
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ from fastapi.params import Path
|
||||||
|
|
||||||
from sqlalchemy.sql import exists
|
from sqlalchemy.sql import exists
|
||||||
|
|
||||||
from src.auth.service import super_admin_dependency
|
|
||||||
from src.database import db_dependency
|
from src.database import db_dependency
|
||||||
from src.contact.models import Contact
|
from src.contact.models import Contact
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ Models:
|
||||||
- List: Description
|
- List: Description
|
||||||
- Models: Description
|
- Models: Description
|
||||||
"""
|
"""
|
||||||
from typing import Optional
|
from typing import Optional, Any
|
||||||
from pydantic import Json
|
from pydantic import Json
|
||||||
|
|
||||||
from src.schemas import CustomBaseModel
|
from src.schemas import CustomBaseModel
|
||||||
|
|
@ -14,14 +14,14 @@ from src.organisation.constants import Status, ContactType
|
||||||
|
|
||||||
class OrgOrgPostRequest(CustomBaseModel):
|
class OrgOrgPostRequest(CustomBaseModel):
|
||||||
name: str
|
name: str
|
||||||
intake_questionnaire: Optional[Json] = None
|
intake_questionnaire: Optional[Json[Any]] = None
|
||||||
|
|
||||||
billing_contact_id: Optional[int] = None
|
billing_contact_id: Optional[int] = None
|
||||||
security_contact_id: Optional[int] = None
|
security_contact_id: Optional[int] = None
|
||||||
owner_contact_id: Optional[int] = None
|
owner_contact_id: Optional[int] = None
|
||||||
|
|
||||||
class OrgQuestionnairePatchRequest(CustomBaseModel):
|
class OrgQuestionnairePatchRequest(CustomBaseModel):
|
||||||
intake_questionnaire: Json
|
intake_questionnaire: Json[Any]
|
||||||
partial: bool
|
partial: bool
|
||||||
|
|
||||||
class OrgStatusPatchRequest(CustomBaseModel):
|
class OrgStatusPatchRequest(CustomBaseModel):
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ Models:
|
||||||
- Models: Description
|
- Models: Description
|
||||||
"""
|
"""
|
||||||
from src.schemas import CustomBaseModel
|
from src.schemas import CustomBaseModel
|
||||||
from pydantic import Field
|
|
||||||
|
|
||||||
|
|
||||||
class OIDCUser(CustomBaseModel):
|
class OIDCUser(CustomBaseModel):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue