feat(usage-stats): add usage stats backend apis

This commit is contained in:
wren
2026-05-09 20:06:59 +08:00
parent c9d7a693b8
commit 4d56652879
7 changed files with 1315 additions and 0 deletions
@@ -0,0 +1,58 @@
"""系统使用统计服务接口。"""
from __future__ import annotations
from abc import ABC, abstractmethod
from typing import Any
from fastapi_modules.fastapi_leaudit.domian.vo.usageStatsVo import (
UsageStatsAreaPageVO,
UsageStatsDepartmentPageVO,
UsageStatsDetailPageVO,
UsageStatsOverviewVO,
UsageStatsTrendVO,
UsageStatsUserPageVO,
)
class IUsageStatsService(ABC):
"""系统使用统计服务接口。"""
@abstractmethod
async def RecordLoginEvent(
self,
*,
UserInfo: dict[str, Any] | None,
Sub: str | None,
LoginResult: str,
LoginType: str,
IpAddress: str | None,
UserAgent: str | None,
FailureReason: str | None = None,
TokenJti: str | None = None,
) -> None:
...
@abstractmethod
async def GetOverview(self, CurrentUserId: int, Filters: dict[str, Any]) -> UsageStatsOverviewVO:
...
@abstractmethod
async def GetTrends(self, CurrentUserId: int, Filters: dict[str, Any]) -> UsageStatsTrendVO:
...
@abstractmethod
async def GetUsers(self, CurrentUserId: int, Filters: dict[str, Any]) -> UsageStatsUserPageVO:
...
@abstractmethod
async def GetDepartments(self, CurrentUserId: int, Filters: dict[str, Any]) -> UsageStatsDepartmentPageVO:
...
@abstractmethod
async def GetAreas(self, CurrentUserId: int, Filters: dict[str, Any]) -> UsageStatsAreaPageVO:
...
@abstractmethod
async def GetDetails(self, CurrentUserId: int, Filters: dict[str, Any]) -> UsageStatsDetailPageVO:
...