account.go 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package models
  2. import (
  3. "errors"
  4. "time"
  5. )
  6. var (
  7. SaveAccount func(account *Account) error
  8. GetAccountByLogin func(emailOrName string) (*Account, error)
  9. GetAccount func(accountId int64) (*Account, error)
  10. GetOtherAccountsFor func(accountId int64) ([]*OtherAccount, error)
  11. GetCollaboratorsForAccount func(accountId int64) ([]*CollaboratorInfo, error)
  12. AddCollaborator func(collaborator *Collaborator) error
  13. )
  14. // Typed errors
  15. var (
  16. ErrAccountNotFound = errors.New("Account not found")
  17. )
  18. type OtherAccount struct {
  19. Id int64
  20. Email string
  21. Role string
  22. }
  23. type Account struct {
  24. Id int64
  25. Login string `xorm:"UNIQUE NOT NULL"`
  26. Email string `xorm:"UNIQUE NOT NULL"`
  27. Name string `xorm:"UNIQUE NOT NULL"`
  28. FullName string
  29. Password string
  30. IsAdmin bool
  31. Salt string `xorm:"VARCHAR(10)"`
  32. Company string
  33. NextDashboardId int
  34. UsingAccountId int64
  35. Created time.Time
  36. Updated time.Time
  37. }