Skip to content

Commit

Permalink
refactor: revert setting outline_geojson in create_app_project
Browse files Browse the repository at this point in the history
  • Loading branch information
spwoodcock committed Jan 31, 2024
1 parent 1c4fcdf commit cdaa6b4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
8 changes: 7 additions & 1 deletion src/backend/app/projects/project_crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -1607,7 +1607,13 @@ async def convert_to_app_project(db_project: db_models.DbProject):
return None

log.debug("Converting db project to app project")
app_project: project_schemas.Project = db_project
app_project = db_project

if db_project.outline:
log.debug("Converting project outline to geojson")
app_project.outline_geojson = geometry_to_geojson(
db_project.outline, {"id": db_project.id}, db_project.id
)

app_project.project_tasks = db_project.tasks

Expand Down
7 changes: 5 additions & 2 deletions src/backend/app/projects/project_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ async def read_project(project_id: int, db: Session = Depends(database.get_db)):
@router.delete("/{project_id}")
async def delete_project(
project: db_models.DbProject = Depends(project_deps.get_project_by_id),
db: Session = Depends(database.get_db),
current_user: AuthUser = Depends(login_required),
db: Session = Depends(database.get_db),
):
"""Delete a project from both ODK Central and the local database."""
log.info(
Expand Down Expand Up @@ -251,7 +251,10 @@ async def create_project(
# Check if organisation exists
org = await organisation_deps.check_org_exists(db, project_info.organisation_id)

log.debug(f"Creating project {project_info.project_info.name}")
log.info(
f"User {current_user.username} attempting creation of project "
f"{project_info.project_info.name}"
)

# Must decrypt ODK password & connect to ODK Central before proj created
if project_info.odk_central_url:
Expand Down
1 change: 0 additions & 1 deletion src/backend/app/projects/project_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ def remove_trailing_slash(cls, value: HttpUrlStr) -> Optional[HttpUrlStr]:
@model_validator(mode="after")
def all_odk_vars_together(self) -> Self:
"""Ensure if one ODK variable is set, then all are."""
log.warning(self.odk_central_url)
if any(
[
self.odk_central_url,
Expand Down

0 comments on commit cdaa6b4

Please sign in to comment.