Skip to content

Commit 3206ff2

Browse files
committed
rename:lindoc->api
1 parent 4337d87 commit 3206ff2

4 files changed

Lines changed: 16 additions & 16 deletions

File tree

app/api/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99

1010
if os.getenv("FLASK_ENV", "production") == "production":
1111
# spectree 暂未提供关闭文档功能,production部署变更随机路径
12-
lindoc = SpecTree(
12+
api = SpecTree(
1313
backend_name="flask",
1414
title="Lin-CMS API",
1515
mode="strict",
1616
version="0.3.0a6",
1717
path="/".join(str(uuid4()).split("-")),
1818
)
1919
else:
20-
lindoc = SpecTree(
20+
api = SpecTree(
2121
backend_name="flask",
2222
title="Lin-CMS API",
2323
mode="strict",

app/api/cms/log.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from lin.redprint import Redprint
99
from sqlalchemy import text
1010

11-
from app.api import lindoc
11+
from app.api import api
1212
from app.validator.schema import (
1313
AuthorizationSchema,
1414
LogPageSchema,
@@ -23,7 +23,7 @@
2323
@log_api.route("/search")
2424
@permission_meta(auth="查询日志", module="日志")
2525
@group_required
26-
@lindoc.validate(
26+
@api.validate(
2727
headers=AuthorizationSchema,
2828
query=LogQuerySearchSchema,
2929
resp=DocResponse(r=LogPageSchema),
@@ -57,7 +57,7 @@ def get_logs():
5757
@log_api.route("/users", methods=["GET"])
5858
@permission_meta(auth="查询日志记录的用户", module="日志")
5959
@group_required
60-
@lindoc.validate(
60+
@api.validate(
6161
headers=AuthorizationSchema,
6262
resp=DocResponse(r=StringList),
6363
tags=["日志"],

app/api/v1/book.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from lin.jwt import group_required, login_required
1212
from lin.redprint import Redprint
1313

14-
from app.api import lindoc
14+
from app.api import api
1515
from app.exception.api import BookNotFound
1616
from app.model.v1.book import Book
1717
from app.validator.schema import (
@@ -25,7 +25,7 @@
2525

2626

2727
@book_api.route("/<int:id>", methods=["GET"])
28-
@lindoc.validate(
28+
@api.validate(
2929
resp=DocResponse(BookNotFound, r=BookSchema),
3030
tags=["图书"],
3131
)
@@ -40,7 +40,7 @@ def get_book(id: int):
4040

4141

4242
@book_api.route("", methods=["GET"])
43-
@lindoc.validate(
43+
@api.validate(
4444
resp=DocResponse(r=BookSchemaList),
4545
tags=["图书"],
4646
)
@@ -53,7 +53,7 @@ def get_books():
5353

5454

5555
@book_api.route("/search", methods=["GET"])
56-
@lindoc.validate(
56+
@api.validate(
5757
query=BookQuerySearchSchema,
5858
resp=DocResponse(BookNotFound, r=BookSchemaList),
5959
tags=["图书"],
@@ -72,7 +72,7 @@ def search():
7272

7373
@book_api.route("", methods=["POST"])
7474
@login_required
75-
@lindoc.validate(
75+
@api.validate(
7676
headers=AuthorizationSchema,
7777
json=BookSchema,
7878
resp=DocResponse(Success(12)),
@@ -89,7 +89,7 @@ def create_book():
8989

9090
@book_api.route("/<int:id>", methods=["PUT"])
9191
@login_required
92-
@lindoc.validate(
92+
@api.validate(
9393
headers=AuthorizationSchema,
9494
json=BookSchema,
9595
resp=DocResponse(Success(13)),
@@ -114,7 +114,7 @@ def update_book(id: int):
114114
@book_api.route("/<int:id>", methods=["DELETE"])
115115
@permission_meta(auth="删除图书", module="图书")
116116
@group_required
117-
@lindoc.validate(
117+
@api.validate(
118118
headers=AuthorizationSchema,
119119
resp=DocResponse(BookNotFound, Success(14)),
120120
tags=["图书"],

app/app.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ def register_blueprints(app):
1515
app.register_blueprint(create_cms(), url_prefix="/cms")
1616

1717

18-
def register_lindoc(app):
19-
from app.api import lindoc
18+
def register_api(app):
19+
from app.api import api
2020

21-
lindoc.register(app)
21+
api.register(app)
2222

2323

2424
def apply_cors(app):
@@ -60,7 +60,7 @@ def create_app(register_all=True, **kwargs):
6060

6161
set_global_config(**kwargs)
6262
register_blueprints(app)
63-
register_lindoc(app)
63+
register_api(app)
6464
apply_cors(app)
6565
Lin(app, **kwargs)
6666
return app

0 commit comments

Comments
 (0)