From 2d0ae1ac762a2ef3785ae8ed929ea2c0646948c4 Mon Sep 17 00:00:00 2001 From: Nikita Gaziev <98274273+zobweyt@users.noreply.github.com> Date: Sat, 11 Jan 2025 22:52:11 +0300 Subject: [PATCH] fix(quotes): properly check for author id This commit solves an issue where author existence check was not performed if author id was 0 (zero) - a falsy value. Now it checks only for None --- src/api/quotes/routes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/quotes/routes.py b/src/api/quotes/routes.py index 83dc8b7..e1f1c5f 100644 --- a/src/api/quotes/routes.py +++ b/src/api/quotes/routes.py @@ -18,7 +18,7 @@ def create_quote( quote_service: QuoteServiceDepends, author_service: AuthorServiceDepends, ): - if args.author_id and not author_service.get_author_by_id(args.author_id): + if args.author_id is not None and not author_service.get_author_by_id(args.author_id): raise HTTPException(status.HTTP_404_NOT_FOUND, _("No author found with the ID '%s'." % (args.author_id,))) return quote_service.create_quote(args, created_by_user_id=current_user.id)