Skip to content

Commit

Permalink
feat : #1 book thumbnail 테이블 data insert 기능 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
Yujin-nKim committed Mar 30, 2024
1 parent 27cfb5b commit 440d94e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion mysql/insert_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
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}'에 대한 썸네일 이미지 데이터가 추가되었습니다.")
2 changes: 1 addition & 1 deletion openAPI/book.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 440d94e

Please sign in to comment.