fullfill graphql usertype; change db session to dep injection

This commit is contained in:
2026-05-20 14:40:05 +08:00
parent f3b7fedade
commit b95cce592f
4 changed files with 47 additions and 14 deletions
+22 -4
View File
@@ -4,17 +4,35 @@ from datetime import datetime
from strawberry.types import Info
from app.utils.format import get_image_url
from app.graphql.context import CustomContext
@strawberry.type
class UserType:
id: strawberry.ID
id: str
email: str
name: Optional[str]
name: str
avatar: str
handle: Optional[str]
avatar: Optional[str]
# 互动统计字段
following_count: int
follower_count: int
# 统计汇总字段
owner_project_count: int
owner_likes_count: int
owner_favorites_count: int
owner_shares_count: int
admin_project_count: int
admin_likes_count: int
admin_favorites_count: int
admin_shares_count: int
user_project_count: int
user_likes_count: int
user_favorites_count: int
user_shares_count: int
created_at: datetime
# 动态解析字段:例如自动处理头像的绝对路径