From d6cb0c814f0ca77712e3d02469bc870be49a1b22 Mon Sep 17 00:00:00 2001 From: spwoodcock Date: Mon, 27 Nov 2023 10:45:43 +0000 Subject: [PATCH] refactor: remove /images/ endpoint, replaced by s3 logos --- .gitignore | 1 - docker-compose.development.yml | 1 - docker-compose.main.yml | 1 - docker-compose.yml | 1 - src/backend/Dockerfile | 1 - src/backend/app/main.py | 16 +--------------- .../src/components/home/ExploreProjectCard.tsx | 6 +----- src/frontend/src/views/Organization.tsx | 6 +----- 8 files changed, 3 insertions(+), 30 deletions(-) diff --git a/.gitignore b/.gitignore index 013ae34374..e43d4b65aa 100644 --- a/.gitignore +++ b/.gitignore @@ -17,7 +17,6 @@ # Distribution / packaging .Python -src/backend/app/images env/ build/ develop-eggs/ diff --git a/docker-compose.development.yml b/docker-compose.development.yml index a79359026c..d6a21eed64 100644 --- a/docker-compose.development.yml +++ b/docker-compose.development.yml @@ -83,7 +83,6 @@ services: container_name: fmtm-api-${GIT_BRANCH} volumes: - fmtm_logs:/opt/logs - - fmtm_images:/opt/app/images - fmtm_tiles:/opt/tiles depends_on: fmtm-db: diff --git a/docker-compose.main.yml b/docker-compose.main.yml index d088ea2fdd..86209686de 100644 --- a/docker-compose.main.yml +++ b/docker-compose.main.yml @@ -68,7 +68,6 @@ services: container_name: fmtm-api-main volumes: - fmtm_logs:/opt/logs - - fmtm_images:/opt/app/images - fmtm_tiles:/opt/tiles depends_on: fmtm-db: diff --git a/docker-compose.yml b/docker-compose.yml index efff6af2dc..73e81a6013 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -74,7 +74,6 @@ services: # tty: true volumes: - fmtm_logs:/opt/logs - - fmtm_images:/opt/app/images - fmtm_tiles:/opt/tiles - ./src/backend/pyproject.toml:/opt/pyproject.toml - ./src/backend/app:/opt/app diff --git a/src/backend/Dockerfile b/src/backend/Dockerfile index f03a1a786a..747db71dc7 100644 --- a/src/backend/Dockerfile +++ b/src/backend/Dockerfile @@ -124,7 +124,6 @@ RUN useradd -u 1001 -m -c "hotosm account" -d /home/appuser -s /bin/false appuse # Add volumes for persistence VOLUME /opt/logs VOLUME /opt/tiles -VOLUME /opt/app/images # Change to non-root user USER appuser # Add Healthcheck diff --git a/src/backend/app/main.py b/src/backend/app/main.py index 852f6f71fc..e50e3d070c 100644 --- a/src/backend/app/main.py +++ b/src/backend/app/main.py @@ -20,7 +20,6 @@ import logging import sys from contextlib import asynccontextmanager -from typing import Optional import sentry_sdk from fastapi import FastAPI, Request @@ -52,7 +51,7 @@ @asynccontextmanager async def lifespan(app: FastAPI): - """Startup events.""" + """FastAPI startup/shutdown event.""" log.debug("Starting up FastAPI server.") log.debug("Reading XLSForms from DB.") await read_xlsforms(next(get_db()), xlsforms_path) @@ -208,16 +207,3 @@ async def validation_exception_handler(request: Request, exc: RequestValidationE async def home(): """Redirect home to docs.""" return RedirectResponse("/docs") - - -@api.get("/items/{item_id}") -async def read_item(item_id: int, q: Optional[str] = None): - """Get item IDs.""" - return {"item_id": item_id, "q": q} - - -@api.get("/images/{image_filename}") -async def get_images(image_filename: str): - """Download image files.""" - path = f"./app/images/{image_filename}" - return FileResponse(path) diff --git a/src/frontend/src/components/home/ExploreProjectCard.tsx b/src/frontend/src/components/home/ExploreProjectCard.tsx index 9fa03d4929..805535c23e 100755 --- a/src/frontend/src/components/home/ExploreProjectCard.tsx +++ b/src/frontend/src/components/home/ExploreProjectCard.tsx @@ -73,11 +73,7 @@ export default function ExploreProjectCard({ data }) {
{data.organisation_logo ? ( - + ) : ( )} diff --git a/src/frontend/src/views/Organization.tsx b/src/frontend/src/views/Organization.tsx index a4a1a8db4e..24aa6ed8fe 100644 --- a/src/frontend/src/views/Organization.tsx +++ b/src/frontend/src/views/Organization.tsx @@ -114,11 +114,7 @@ const Organization = () => {