fix: ruff lint + format fixes in tests, ESLint fixes in frontend
This commit is contained in:
@@ -25,8 +25,12 @@ router = APIRouter(prefix="/contacts", tags=["contacts"])
|
||||
async def list_contacts(
|
||||
db: AsyncSession = Depends(get_db),
|
||||
pagination: dict = Depends(get_pagination),
|
||||
search: str | None = Query(None, description="Search in company_name, city, email, vat_id"),
|
||||
role: str | None = Query(None, description="Filter by role (kaeufer, verkaeufer, beide)"),
|
||||
search: str | None = Query(
|
||||
None, description="Search in company_name, city, email, vat_id"
|
||||
),
|
||||
role: str | None = Query(
|
||||
None, description="Filter by role (kaeufer, verkaeufer, beide)"
|
||||
),
|
||||
is_eu: bool | None = Query(None, description="Filter EU (true) or Inland (false)"),
|
||||
is_private: bool | None = Query(None, description="Filter private contacts"),
|
||||
sort: str | None = Query(None, description="Sort field (prefix - for descending)"),
|
||||
@@ -66,7 +70,9 @@ async def create_contact(
|
||||
return ContactResponse.model_validate(contact)
|
||||
|
||||
|
||||
@router.get("/{contact_id}", response_model=ContactResponse, status_code=status.HTTP_200_OK)
|
||||
@router.get(
|
||||
"/{contact_id}", response_model=ContactResponse, status_code=status.HTTP_200_OK
|
||||
)
|
||||
async def get_contact(
|
||||
contact_id: uuid.UUID,
|
||||
db: AsyncSession = Depends(get_db),
|
||||
@@ -77,12 +83,16 @@ async def get_contact(
|
||||
if contact is None:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_404_NOT_FOUND,
|
||||
detail={"error": {"code": "CONTACT_NOT_FOUND", "message": "Contact not found"}},
|
||||
detail={
|
||||
"error": {"code": "CONTACT_NOT_FOUND", "message": "Contact not found"}
|
||||
},
|
||||
)
|
||||
return ContactResponse.model_validate(contact)
|
||||
|
||||
|
||||
@router.put("/{contact_id}", response_model=ContactResponse, status_code=status.HTTP_200_OK)
|
||||
@router.put(
|
||||
"/{contact_id}", response_model=ContactResponse, status_code=status.HTTP_200_OK
|
||||
)
|
||||
async def update_contact(
|
||||
contact_id: uuid.UUID,
|
||||
body: ContactUpdate,
|
||||
@@ -100,12 +110,16 @@ async def update_contact(
|
||||
if contact is None:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_404_NOT_FOUND,
|
||||
detail={"error": {"code": "CONTACT_NOT_FOUND", "message": "Contact not found"}},
|
||||
detail={
|
||||
"error": {"code": "CONTACT_NOT_FOUND", "message": "Contact not found"}
|
||||
},
|
||||
)
|
||||
return ContactResponse.model_validate(contact)
|
||||
|
||||
|
||||
@router.delete("/{contact_id}", response_model=ContactResponse, status_code=status.HTTP_200_OK)
|
||||
@router.delete(
|
||||
"/{contact_id}", response_model=ContactResponse, status_code=status.HTTP_200_OK
|
||||
)
|
||||
async def delete_contact(
|
||||
contact_id: uuid.UUID,
|
||||
db: AsyncSession = Depends(get_db),
|
||||
@@ -116,7 +130,9 @@ async def delete_contact(
|
||||
if contact is None:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_404_NOT_FOUND,
|
||||
detail={"error": {"code": "CONTACT_NOT_FOUND", "message": "Contact not found"}},
|
||||
detail={
|
||||
"error": {"code": "CONTACT_NOT_FOUND", "message": "Contact not found"}
|
||||
},
|
||||
)
|
||||
return ContactResponse.model_validate(contact)
|
||||
|
||||
@@ -139,7 +155,9 @@ async def add_contact_person(
|
||||
if person is None:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_404_NOT_FOUND,
|
||||
detail={"error": {"code": "CONTACT_NOT_FOUND", "message": "Contact not found"}},
|
||||
detail={
|
||||
"error": {"code": "CONTACT_NOT_FOUND", "message": "Contact not found"}
|
||||
},
|
||||
)
|
||||
return ContactPersonResponse.model_validate(person)
|
||||
|
||||
@@ -159,6 +177,11 @@ async def remove_contact_person(
|
||||
if not deleted:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_404_NOT_FOUND,
|
||||
detail={"error": {"code": "PERSON_NOT_FOUND", "message": "Contact person not found"}},
|
||||
detail={
|
||||
"error": {
|
||||
"code": "PERSON_NOT_FOUND",
|
||||
"message": "Contact person not found",
|
||||
}
|
||||
},
|
||||
)
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user