Skip to content

Commit

Permalink
refactor: set uuid directly for project_uuid
Browse files Browse the repository at this point in the history
  • Loading branch information
spwoodcock committed Nov 21, 2023
1 parent 3ef024a commit 093c847
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/backend/app/projects/project_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,8 @@ async def read_project_summaries(
@router.get("/{project_id}", response_model=project_schemas.ProjectOut)
async def read_project(project_id: int, db: Session = Depends(database.get_db)):
project = project_crud.get_project_by_id(db, project_id)
project_uuid = uuid.uuid4()
if project:
project.project_uuid = project_uuid
project.project_uuid = uuid.uuid4()
return project
else:
raise HTTPException(status_code=404, detail="Project not found")
Expand Down Expand Up @@ -224,9 +223,8 @@ async def create_project(
project = project_crud.create_project_with_project_info(
db, project_info, odkproject["id"]
)
project_uuid = uuid.uuid4()
if project:
project.project_uuid = project_uuid
project.project_uuid = uuid.uuid4()
return project
else:
raise HTTPException(status_code=404, detail="Project not found")
Expand Down

0 comments on commit 093c847

Please sign in to comment.