From 0f898b968dddcbc3a534d1e8669ea60d6eb2a1d7 Mon Sep 17 00:00:00 2001 From: HellsSenju Date: Wed, 2 Oct 2024 10:47:53 +0400 Subject: [PATCH] tot --- .../book_service/book_service.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/tsukanova_irina_lab_3/book_service/book_service.py b/tsukanova_irina_lab_3/book_service/book_service.py index 100e8e8..624a6df 100644 --- a/tsukanova_irina_lab_3/book_service/book_service.py +++ b/tsukanova_irina_lab_3/book_service/book_service.py @@ -80,13 +80,16 @@ def get_all(): return list_jsonify(), 200 -# @app.route('/', methods=['GET']) -# def get_all_full(): -# response = [] -# for book in books: -# response.append(requests.get(authors_url + str(book.author_id)).json()) -# -# return list_jsonify(), 200 +@app.route('/full', methods=['GET']) +def get_all_full(): + authors: list[dict] = requests.get(authors_url).json() + response = [] + for book in books: + for author in authors: + if book.author_id == uuid.UUID(author.get('uuid')): + response.append(book.to_dict_with_info(author)) + + return response, 200 @app.route('/by-author/', methods=['GET'])