Skip to content

Commit

Permalink
Merge branch 'upload-to-s3' of github.com:hotosm/fmtm into upload-to-s3
Browse files Browse the repository at this point in the history
  • Loading branch information
nrjadkry committed Nov 24, 2023
2 parents b75518f + 1d84ab6 commit ae9e318
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/backend/app/organization/organization_crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@
import random
import re
import string
from io import BytesIO

from fastapi import HTTPException, UploadFile
from loguru import logger as log
from sqlalchemy import func
from sqlalchemy.orm import Session
from app.s3 import add_obj_to_bucket

from app.config import settings
from io import BytesIO
from app.s3 import add_obj_to_bucket

from ..db import db_models

IMAGEDIR = "app/images/"
Expand Down Expand Up @@ -102,10 +104,12 @@ async def create_organization(
file_obj = BytesIO(file_bytes)

# Upload image in s3
add_obj_to_bucket(settings.S3_BUCKET_NAME,
file_obj,
f"/organisation_logo/{logo.filename}",
content_type=logo.content_type)
add_obj_to_bucket(
settings.S3_BUCKET_NAME,
file_obj,
f"/organisation_logo/{logo.filename}",
content_type=logo.content_type,
)

# create new organization object
db_organization = db_models.DbOrganisation(
Expand Down

0 comments on commit ae9e318

Please sign in to comment.