feat(auth、user):新增用户的粉丝数、关注数、简介

This commit is contained in:
xingc
2025-10-16 15:28:07 +08:00
parent cddb0ab0dd
commit 0cf3145e86
5 changed files with 99 additions and 11 deletions

View File

@@ -18,6 +18,7 @@ from core.routers.auth.schema import LoginUser
from core.routers.auth.services import get_current_user_form_http
from . import schema
from .actions import update_user_follower_total
user_router = APIRouter(prefix='/user', tags=['用户模块'])
@@ -158,10 +159,15 @@ async def follow_user(
}
if action == 'follower':
await db_crud.create(data=record, filters=record)
if action == 'unfollower':
elif action == 'unfollower':
await db_crud.delete(filters=record)
await update_user_follower_total(
follower_id=login_user.user_id,
followed_id=follower_user.user_id,
db_session=db_session
)
return {'message': 'ok'}