1111from app .api import lindoc
1212from app .validator .schema import (
1313 AuthorizationSchema ,
14- LogListSchema ,
14+ LogPageSchema ,
1515 LogQuerySearchSchema ,
16- NameListSchema ,
16+ StringList ,
1717)
1818
1919log_api = Redprint ("log" )
2626@lindoc .validate (
2727 headers = AuthorizationSchema ,
2828 query = LogQuerySearchSchema ,
29- resp = DocResponse (http_200 = LogListSchema ),
29+ resp = DocResponse (http_200 = LogPageSchema ),
3030 before = LogQuerySearchSchema .offset_handler ,
3131 tags = ["日志" ],
3232)
@@ -49,7 +49,7 @@ def get_logs():
4949 )
5050 total_page = math .ceil (total / g .count )
5151
52- return LogListSchema (
52+ return LogPageSchema (
5353 page = g .page , count = g .count , total = total , items = items , total_page = total_page
5454 )
5555
@@ -59,7 +59,7 @@ def get_logs():
5959@group_required
6060@lindoc .validate (
6161 headers = AuthorizationSchema ,
62- resp = DocResponse (http_200 = NameListSchema ),
62+ resp = DocResponse (http_200 = StringList ),
6363 tags = ["日志" ],
6464)
6565def get_users_for_log ():
@@ -73,4 +73,4 @@ def get_users_for_log():
7373 .having (text ("count(username) > 0" ))
7474 .all ()
7575 )
76- return NameListSchema ( items = [u .username for u in usernames ])
76+ return StringList . parse_obj ( [u .username for u in usernames ])
0 commit comments