Skip to content

Commit

Permalink
fix(backend): allow missing odk_token for project, but log warning
Browse files Browse the repository at this point in the history
  • Loading branch information
spwoodcock committed Apr 8, 2024
1 parent 9f08520 commit a50540a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/backend/app/projects/project_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,10 @@ async def read_project(project_id: int, db: Session = Depends(database.get_db)):
project = await project_crud.get_project_by_id(db, project_id)
if not project:
raise HTTPException(status_code=404, detail="Project not found")
if project.odk_token == "":
log.warning(
f"Project ({project.id}) has no 'odk_token' set. The QRCode will not work!"
)
return project


Expand Down
2 changes: 1 addition & 1 deletion src/backend/app/projects/project_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ class ProjectOut(ProjectWithTasks):
class ReadProject(ProjectWithTasks):
"""Redundant model for refactor."""

odk_token: str
odk_token: Optional[str] = None
project_uuid: uuid.UUID = uuid.uuid4()
location_str: Optional[str] = None
data_extract_url: Optional[str] = None
Expand Down

0 comments on commit a50540a

Please sign in to comment.