File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -73,4 +73,4 @@ def get_users_for_log():
7373 .having (text ("count(username) > 0" ))
7474 .all ()
7575 )
76- return StringList . parse_obj ( [u .username for u in usernames ])
76+ return [u .username for u in usernames ]
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ def get_book(id):
3636 """
3737 book = Book .get (id = id )
3838 if book :
39- return BookOutSchema . parse_obj ( book )
39+ return book
4040 raise BookNotFound
4141
4242
@@ -49,8 +49,7 @@ def get_books():
4949 """
5050 获取图书列表
5151 """
52- books = Book .get (one = False )
53- return BookSchemaList .parse_obj (books )
52+ return Book .get (one = False )
5453
5554
5655@book_api .route ("/search" )
@@ -63,11 +62,9 @@ def search():
6362 """
6463 关键字搜索图书
6564 """
66- books = Book .query .filter (
65+ return Book .query .filter (
6766 Book .title .like ("%" + g .q + "%" ), Book .delete_time == None
6867 ).all ()
69- if books :
70- return BookSchemaList .parse_obj (books )
7168
7269
7370@book_api .route ("" , methods = ["POST" ])
You can’t perform that action at this time.
0 commit comments