fullfill graphql usertype; change db session to dep injection
This commit is contained in:
+22
-4
@@ -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
|
||||
|
||||
# 动态解析字段:例如自动处理头像的绝对路径
|
||||
|
||||
Reference in New Issue
Block a user