From 3c757df7f176f25313d662b5201b1679c84a1716 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Kv=C3=A1=C4=8Dek?= Date: Thu, 18 Jan 2024 06:53:01 +0100 Subject: [PATCH] Bugfixing --- src/background_jobs/photo.py | 4 ++-- src/graphql_schema/entities/resolvers/photo.py | 2 +- src/graphql_schema/entities/types/mutation_input.py | 2 +- src/scripts/migrate_photos_to_webp.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/background_jobs/photo.py b/src/background_jobs/photo.py index 627d6d5..64125fe 100644 --- a/src/background_jobs/photo.py +++ b/src/background_jobs/photo.py @@ -10,8 +10,8 @@ async def resize_photo(path: str, filename: str, photo_id: int): editor.resize(new_width=2500) name, _ = os.path.splitext(filename) - editor.write_to_file(quality=85, format_="webp", dest_filename=f"{name}.webp") - editor.write_to_file(quality=85) # toto je potreba pro prvni nacteni nahledu ihned po nahrani, pripadne pro + editor.write_to_file(quality=95, format_="webp", dest_filename=f"{name}.webp") + editor.write_to_file(quality=80) # toto je potreba pro prvni nacteni nahledu ihned po nahrani, pripadne pro # vygenerovani nahledu (async, muze se delat pred/behem zmensovani fotky -> v tu dobu jeste neexistuje webp) width, height = editor.img_size diff --git a/src/graphql_schema/entities/resolvers/photo.py b/src/graphql_schema/entities/resolvers/photo.py index 2087058..9a353e3 100644 --- a/src/graphql_schema/entities/resolvers/photo.py +++ b/src/graphql_schema/entities/resolvers/photo.py @@ -80,7 +80,7 @@ class PhotoMutationResolver(BaseMutationResolver): async with get_session() as db: photo = await self._get_one(db, id, created_by_id=user_id) flight_id = photo.flight_id - filename = photo.filename + filename = photo.filename+"."+photo.filename_extension path = get_photo_basepath(flight_id) return PhotoDetailInfo( diff --git a/src/graphql_schema/entities/types/mutation_input.py b/src/graphql_schema/entities/types/mutation_input.py index 277ab9b..adb757e 100644 --- a/src/graphql_schema/entities/types/mutation_input.py +++ b/src/graphql_schema/entities/types/mutation_input.py @@ -49,7 +49,7 @@ class CreateEventInput(BaseGraphqlInputType): pass -@strawberry_sqlalchemy_input(model=models.Event, exclude_fields=["id"]) +@strawberry_sqlalchemy_input(model=models.Event, exclude_fields=["id"], all_optional=True) class EditEventInput(BaseGraphqlInputType): pass diff --git a/src/scripts/migrate_photos_to_webp.py b/src/scripts/migrate_photos_to_webp.py index e1fad8d..c6fabaa 100644 --- a/src/scripts/migrate_photos_to_webp.py +++ b/src/scripts/migrate_photos_to_webp.py @@ -35,7 +35,7 @@ async def migrate_photos_to_webp(): await models.Photo.update(session, { "filename": new_filename, "cache_key": int(time.time()), - "filename_ext": "webp", + "filename_extension": "webp", }, obj=photo) print(path, photo.filename, "=>", new_filename, "OK") except (Exception, DecompressionBombWarning) as e: