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

@@ -11,9 +11,9 @@ from typing import List
import ujson
from sqlalchemy import (
Column, Integer, String, Text, Date,
Integer, String, Text, Date,
ForeignKey, DECIMAL, CheckConstraint,
UniqueConstraint, Index, Sequence, JSON, Enum, Boolean, UUID, Table
UniqueConstraint, Index, Sequence, JSON, Enum, Boolean
)
from sqlalchemy.orm import (
DeclarativeBase, Mapped, mapped_column, relationship
@@ -80,6 +80,10 @@ class User(BaseModel, DateModel):
phone: Mapped[str] = mapped_column(String(11), nullable=True, comment='手机号码')
vip_expire_date: Mapped[date] = mapped_column(Date, default=set_default_vip_expire_date, comment='会员到期时间')
points: Mapped[int] = mapped_column(Integer, default=0, comment='会员积分')
description: Mapped[str] = mapped_column(String(200), default='', comment='用户简介')
fans_count: Mapped[int] = mapped_column(Integer, default=0, comment='粉丝数')
followers_count: Mapped[int] = mapped_column(Integer, default=0, comment='关注数')
last_active_at: Mapped[datetime] = mapped_column(nullable=True, comment='最后活跃时间')
collections: Mapped[list['UserCollection']] = relationship(
back_populates='user',