Skip to content

Commit bb58b73

Browse files
committed
Fix: db errors in adding new book
1 parent db2d2a9 commit bb58b73

File tree

1 file changed

+5
-1
lines changed
  • bases/rsptx/author_server_api

1 file changed

+5
-1
lines changed

bases/rsptx/author_server_api/main.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
)
4646
from rsptx.auth.session import is_instructor
4747
from rsptx.db.crud import (
48+
create_book_author,
4849
create_library_book,
4950
fetch_instructor_courses,
5051
fetch_books_by_author,
@@ -99,8 +100,9 @@ async def create_book_entry(author: str, document_id: str, github: str):
99100
)
100101
await create_course(course)
101102

102-
vals = {"authors": author, "basecourse": document_id, "github_url": github}
103+
vals = {"authors": author, "title": document_id, "github_url": github}
103104
await create_library_book(document_id, vals)
105+
await create_book_author(author, document_id)
104106
return True
105107

106108

@@ -378,6 +380,8 @@ async def check_db(payload=Body(...)):
378380
async def new_course(payload=Body(...), user=Depends(auth_manager)):
379381
base_course = payload["bcname"]
380382
github_url = payload["github"]
383+
logger.debug(f"Got {base_course} and {github_url}")
384+
381385
if "DEV_DBURL" not in os.environ:
382386
return JSONResponse({"detail": "DBURL is not set"})
383387
else:

0 commit comments

Comments
 (0)