user.prisma 1.1 KB

123456789101112131415161718192021222324252627
  1. model User {
  2. id Int @id @default(autoincrement())
  3. username String @unique
  4. password String
  5. status Int @default(1)
  6. nick String? @db.VarChar(100)
  7. photo String? @db.VarChar(1024)
  8. remark String? @db.VarChar(256)
  9. twoFA String? @db.VarChar(256)
  10. twoFALastUsedStep Int? /// prevent same 30-sec TOTP from being reused.
  11. twoFARecoveryCodes Json? /// array of hashed backup codes.
  12. createTime DateTime @default(now()) @map("create_time")
  13. updateTime DateTime @default(now()) @updatedAt @map("update_time")
  14. allowIps Json? /// 允许访问的IP列表
  15. // add user latest jwt token, update when user login, jwt guard to check if use current session jwt token matched then allow operations
  16. jwtToken String? @db.VarChar(1024)
  17. oAuthJwtToken String? @db.VarChar(1024)
  18. userRoles UserRole[]
  19. // add user last login date time
  20. lastLoginTime DateTime @default(now()) @map("lastLoginTime")
  21. @@map("sys_user")
  22. }