Skip to content

Commit

Permalink
Setting of ID in creation is optional
Browse files Browse the repository at this point in the history
  • Loading branch information
hellais committed Oct 11, 2024
1 parent fd6dc5c commit 6328f79
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
10 changes: 3 additions & 7 deletions ooniapi/services/oonifindings/src/oonifindings/routers/v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def utcnow_seconds():


class OONIFindingId(BaseModel):
incident_id: str = Field(alias="id")
incident_id: Optional[str] = Field(alias="id", default=None)


class OONIFindingWithMail(OONIFindingId):
Expand Down Expand Up @@ -493,10 +493,6 @@ def delete_oonifinding(
return {}


class OONIFindingsPublish(BaseModel):
id: str = Field(title="ID of the finding")


@router.post(
"/v1/incidents/{action}",
tags=["oonifindings"],
Expand All @@ -505,7 +501,7 @@ class OONIFindingsPublish(BaseModel):
)
def update_oonifinding_publish_status(
action: str,
publish_request: OONIFindingsPublish,
publish_request: OONIFindingId,
response: Response,
db=Depends(get_postgresql_session),
):
Expand All @@ -516,7 +512,7 @@ def update_oonifinding_publish_status(
raise HTTPException(status_code=400, detail="Invalid query action")

assert publish_request
finding_id = publish_request.id
finding_id = publish_request.incident_id

q = db.query(models.OONIFinding).filter(models.OONIFinding.finding_id == finding_id)

Expand Down
1 change: 0 additions & 1 deletion ooniapi/services/oonifindings/tests/test_oonifindings.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
SAMPLE_EMAIL = "[email protected]"

SAMPLE_OONIFINDING = {
"id": "",
"title": "sample oonifinding",
"short_description": "sample oonifinding description",
"reported_by": "sample user",
Expand Down

0 comments on commit 6328f79

Please sign in to comment.