diff --git a/mysql/insert_query.py b/mysql/insert_query.py index de61bcc..5aabdbb 100644 --- a/mysql/insert_query.py +++ b/mysql/insert_query.py @@ -77,4 +77,10 @@ def insert_book_info(cursor, book_info, publisher_id): inserted_book_id = cursor.lastrowid print(f"책 이름 : '{book_info['book_name']}', Primary key : '{inserted_book_id}' 데이터가 추가되었습니다.") - return inserted_book_id \ No newline at end of file + return inserted_book_id + +def insert_book_thumbnail(cursor, book_id, image_url): + insert_query = "INSERT INTO book_thumbnails (book_id, thumbnail_image_url) VALUES (%s, %s)" + execute_query(cursor, insert_query, (book_id, image_url, )) + + print(f"book_id : '{book_id}'에 대한 썸네일 이미지 데이터가 추가되었습니다.") diff --git a/openAPI/book.py b/openAPI/book.py index 69efa24..cd2d324 100644 --- a/openAPI/book.py +++ b/openAPI/book.py @@ -46,10 +46,10 @@ def isbn_list_by_category_id(): inserted_publisher_id = insert_publisher(cursor, result['publisher']) # TODO : 도서 데이터 insert - inserted_book_id = insert_book_info(cursor, result['book_info'], inserted_publisher_id) # TODO : 도서 썸네일 이미지 insert + insert_book_thumbnail(cursor, inserted_book_id, result['book_thumbnail_image_url']) # TODO : 도서 미리보기 이미지 insert