Skip to content

Commit aefc401

Browse files
committed
fix:log username list
1 parent a1c1aab commit aefc401

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

app/api/cms/log.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from flask import g
44
from lin import permission_meta
5-
from lin.apidoc import api, DocResponse
5+
from lin.apidoc import DocResponse, api
66
from lin.db import db
77
from lin.jwt import group_required
88
from lin.logger import Log
@@ -13,7 +13,7 @@
1313
AuthorizationSchema,
1414
LogPageSchema,
1515
LogQuerySearchSchema,
16-
StringList,
16+
UsernameListSchema,
1717
)
1818

1919
log_api = Redprint("log")
@@ -59,7 +59,7 @@ def get_logs():
5959
@group_required
6060
@api.validate(
6161
headers=AuthorizationSchema,
62-
resp=DocResponse(r=StringList),
62+
resp=DocResponse(r=UsernameListSchema),
6363
tags=["日志"],
6464
)
6565
def get_users_for_log():
@@ -73,4 +73,4 @@ def get_users_for_log():
7373
.having(text("count(username) > 0"))
7474
.all()
7575
)
76-
return [u.username for u in usernames]
76+
return UsernameListSchema(items=[u.username for u in usernames])

app/api/v1/book.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from flask import g, request
99
from lin import permission_meta
10-
from lin.apidoc import api, DocResponse
10+
from lin.apidoc import DocResponse, api
1111
from lin.exception import Success
1212
from lin.jwt import group_required, login_required
1313
from lin.redprint import Redprint

app/validator/schema.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ class BookQuerySearchSchema(BaseModel):
1717
q: Optional[str] = str()
1818

1919

20-
class StringList(BaseModel):
21-
__root__: List[str]
20+
class UsernameListSchema(BaseModel):
21+
items: List[str]
2222

2323

2424
class LogQuerySearchSchema(BaseModel):

0 commit comments

Comments
 (0)