user.ts 1020 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import { Brand } from './helpers/brand'
  2. export type RefProviders = {
  3. mendeley?: boolean
  4. zotero?: boolean
  5. }
  6. export type UserId = Brand<string, 'UserId'>
  7. export type Features = {
  8. aiErrorAssistant?: boolean
  9. collaborators?: number
  10. compileGroup?: 'standard' | 'priority'
  11. compileTimeout?: number
  12. dropbox?: boolean
  13. gitBridge?: boolean
  14. github?: boolean
  15. mendeley?: boolean
  16. references?: boolean
  17. referencesSearch?: boolean
  18. symbolPalette?: boolean
  19. templates?: boolean
  20. trackChanges?: boolean
  21. versioning?: boolean
  22. zotero?: boolean
  23. }
  24. export type User = {
  25. id: UserId | null
  26. isAdmin?: boolean
  27. email: string
  28. allowedFreeTrial?: boolean
  29. first_name?: string
  30. last_name?: string
  31. alphaProgram?: boolean
  32. betaProgram?: boolean
  33. labsProgram?: boolean
  34. isLatexBeginner?: boolean
  35. signUpDate?: string // date string
  36. features?: Features
  37. refProviders?: RefProviders
  38. writefull?: {
  39. enabled: boolean
  40. }
  41. }
  42. export type MongoUser = Pick<User, Exclude<keyof User, 'id'>> & { _id: string }