feat: 添加用户关注功能
- 新增 Follow 表和 User.bio 字段 (Prisma schema)
- 创建 follow 模块 (action-service-repository)
- 新增 FollowButton/FollowStats/UserList 组件
- 用户页面显示 bio、粉丝/关注数、关注按钮
- 新增 /users/[username]/followers 和 following 页面
- 添加 en-US/zh-CN i18n 翻译
⚠️ 需要运行: prisma migrate dev --name add_follow_and_bio
This commit is contained in:
@@ -17,12 +17,15 @@ model User {
|
||||
updatedAt DateTime @updatedAt
|
||||
displayUsername String?
|
||||
username String @unique
|
||||
bio String?
|
||||
accounts Account[]
|
||||
dictionaryLookUps DictionaryLookUp[]
|
||||
folders Folder[]
|
||||
folderFavorites FolderFavorite[]
|
||||
sessions Session[]
|
||||
translationHistories TranslationHistory[]
|
||||
followers Follow[] @relation("UserFollowers")
|
||||
following Follow[] @relation("UserFollowing")
|
||||
|
||||
@@map("user")
|
||||
}
|
||||
@@ -198,3 +201,18 @@ model TranslationHistory {
|
||||
@@index([translatedText, sourceLanguage, targetLanguage])
|
||||
@@map("translation_history")
|
||||
}
|
||||
|
||||
model Follow {
|
||||
id String @id @default(cuid())
|
||||
followerId String @map("follower_id")
|
||||
followingId String @map("following_id")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
|
||||
follower User @relation("UserFollowers", fields: [followerId], references: [id], onDelete: Cascade)
|
||||
following User @relation("UserFollowing", fields: [followingId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([followerId, followingId])
|
||||
@@index([followerId])
|
||||
@@index([followingId])
|
||||
@@map("follows")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user