优化系统界面并接入正式品牌标识
This commit is contained in:
@@ -7,13 +7,13 @@ from app.api.deps import require_roles
|
||||
from app.core.paths import data_path
|
||||
from app.db.session import get_db
|
||||
from app.models import AdminUser, OperationLog
|
||||
from app.schemas.log import OperationLogOut
|
||||
from app.schemas.log import OperationLogPage
|
||||
from app.services.logs import HIGH_RISK_LOG_RETENTION_DAYS, LOG_RETENTION_DAYS, cleanup_expired_logs, format_log
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.get("", response_model=list[OperationLogOut])
|
||||
@router.get("", response_model=OperationLogPage)
|
||||
def list_logs(
|
||||
action: str | None = Query(default=None),
|
||||
object_type: str | None = Query(default=None),
|
||||
|
||||
@@ -19,3 +19,11 @@ class OperationLogOut(BaseModel):
|
||||
summary: str | None = None
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
|
||||
class OperationLogPage(BaseModel):
|
||||
items: list[OperationLogOut]
|
||||
total: int
|
||||
page: int
|
||||
page_size: int
|
||||
total_pages: int
|
||||
|
||||
@@ -208,7 +208,7 @@ def render_practice_camp_certificate_image(certificate: Certificate, learner: Le
|
||||
(end_month, 1058),
|
||||
]:
|
||||
draw.text(
|
||||
(x * x_scale, 648 * y_scale),
|
||||
(x * x_scale, 658 * y_scale),
|
||||
value,
|
||||
fill="#202020",
|
||||
font=font(41, "song", False, text_scale),
|
||||
@@ -217,7 +217,7 @@ def render_practice_camp_certificate_image(certificate: Certificate, learner: Le
|
||||
|
||||
issue_date_text = f"{issue_year}年{issue_month}月{issue_day}日"
|
||||
issue_date_font = font(36, "song", False, text_scale)
|
||||
issue_date_position = (568 * x_scale, 1140 * y_scale)
|
||||
issue_date_position = (568 * x_scale, 1149 * y_scale)
|
||||
draw.rectangle(
|
||||
(
|
||||
442 * x_scale,
|
||||
@@ -362,7 +362,7 @@ def draw_issue_date_numbers(
|
||||
y_scale: float,
|
||||
) -> None:
|
||||
text_font = font(13, "song", False, scale)
|
||||
y = 682 * y_scale
|
||||
y = 685 * y_scale
|
||||
for value, x in [(issue_year, 500), (issue_month, 535), (issue_day, 566)]:
|
||||
draw.text((x * x_scale, y), value, fill="#111111", font=text_font, anchor="mm")
|
||||
|
||||
|
||||
8
backend/tests/test_admin_logs.py
Normal file
8
backend/tests/test_admin_logs.py
Normal file
@@ -0,0 +1,8 @@
|
||||
from app.api.routes.admin_logs import router
|
||||
from app.schemas.log import OperationLogPage
|
||||
|
||||
|
||||
def test_operation_log_list_uses_paginated_response_model():
|
||||
list_route = next(route for route in router.routes if route.path == "")
|
||||
|
||||
assert list_route.response_model is OperationLogPage
|
||||
Reference in New Issue
Block a user