04c7b547aa
- 新增 /api/auth/register 和 /api/auth/login 接口,使用 bcryptjs 哈希密码 - User 模型改为 username + passwordHash,id 自动生成 cuid - 新增 AuthModal 组件(登录/注册双标签页),替换旧的 ProfileSetupModal - 重写 /profile 页面:支持修改用户名、密码、头像、绑定邮箱、退出登录 - /api/user PUT 支持密码修改(需验证当前密码)和用户名唯一性校验 - 游客模式保留,右上角显示"登录"按钮;登录后显示头像和用户名 - 全局 nickname -> username 重命名(types、SwipeDeck、RoomManageModal、buildRoomStatus) - 新增 logout() 清除登录态并重新生成游客 UUID
48 lines
1.1 KiB
Plaintext
48 lines
1.1 KiB
Plaintext
datasource db {
|
|
provider = "sqlite"
|
|
url = "file:./dev.db"
|
|
}
|
|
|
|
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
model Room {
|
|
id String @id
|
|
data String
|
|
createdAt DateTime @default(now())
|
|
expiresAt DateTime
|
|
}
|
|
|
|
model User {
|
|
id String @id @default(cuid())
|
|
username String @unique
|
|
passwordHash String
|
|
avatar String @default("🐱")
|
|
email String? @unique
|
|
preferences String @default("{}")
|
|
createdAt DateTime @default(now())
|
|
decisions Decision[]
|
|
favorites Favorite[]
|
|
}
|
|
|
|
model Decision {
|
|
id String @id @default(cuid())
|
|
userId String
|
|
roomId String
|
|
restaurantName String
|
|
restaurantData String
|
|
matchType String
|
|
participants Int
|
|
createdAt DateTime @default(now())
|
|
user User @relation(fields: [userId], references: [id])
|
|
}
|
|
|
|
model Favorite {
|
|
id String @id @default(cuid())
|
|
userId String
|
|
restaurantData String
|
|
createdAt DateTime @default(now())
|
|
user User @relation(fields: [userId], references: [id])
|
|
}
|