Skip to content

Commit

Permalink
✨ feat: 添加新功能
Browse files Browse the repository at this point in the history
  • Loading branch information
v_wieszheng(郑市委) committed Sep 2, 2024
1 parent 716e907 commit 55d59e4
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
4 changes: 2 additions & 2 deletions app/crud/config/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ class EnvironmentCRUD(BaseCRUD):
@classmethod
async def get_list(
cls,
limit: int = 10,
offset: int = 1,
limit: int,
offset: int,
name: str = None,
):
filter_params = {}
Expand Down
8 changes: 5 additions & 3 deletions app/service/config/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,15 @@ async def update_environment(

@staticmethod
async def get_environments(
current: Annotated[int, Query(...)] = 1,
pageSize: Annotated[int, Query(...)] = 10,
current: Annotated[int, Query(..., ge=1, description="Page number")] = 1,
pageSize: Annotated[
int, Query(..., gt=0, le=100, description="Page size")
] = 10,
name: Annotated[str | None, Query(description="环境名称")] = None,
) -> ResponseModel:

result = await EnvironmentCRUD.get_list(
limit=current, offset=pageSize, name=name
limit=pageSize, offset=current, name=name
)

return await ResponseBase.success(
Expand Down
8 changes: 4 additions & 4 deletions app/service/project/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ class ProjectService:

@staticmethod
async def get_projects(
page: Annotated[int, Query(..., ge=1, description="Page number")] = 1,
page_size: Annotated[
current: Annotated[int, Query(..., ge=1, description="Page number")] = 1,
pageSize: Annotated[
int, Query(..., gt=0, le=100, description="Page size")
] = 10,
) -> ResponseModel:

result = await ProjectCRUD.get_multi_joined(
limit=page_size,
offset=compute_offset(page, page_size),
limit=pageSize,
offset=compute_offset(current, pageSize),
sort_columns="id",
sort_orders="desc",
join_model=User,
Expand Down
10 changes: 10 additions & 0 deletions test/formatted.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,13 @@ def format_line(name, value, comment):
if not name:
filters = {"name__like": name}
print(filters)

import json

data = {
"Resources": [],
"ImageInfo": {"ClothesCode": "some_value"}, # 这里可以根据实际情况填充
}

data_str = json.dumps(data, ensure_ascii=False)
print(data_str)

0 comments on commit 55d59e4

Please sign in to comment.