user.go 698 B

12345678910111213141516171819202122232425262728293031
  1. package models
  2. import (
  3. "github.com/porter-dev/porter/api/types"
  4. "gorm.io/gorm"
  5. )
  6. // User type that extends gorm.Model
  7. type User struct {
  8. gorm.Model
  9. Email string `json:"email" gorm:"unique"`
  10. Password string `json:"password"`
  11. EmailVerified bool `json:"email_verified"`
  12. // ID of oauth integration for github connection (optional)
  13. GithubAppIntegrationID uint
  14. // The github user id used for login (optional)
  15. GithubUserID int64
  16. GoogleUserID string
  17. }
  18. // ToUserType generates an external types.User to be shared over REST
  19. func (u *User) ToUserType() *types.User {
  20. return &types.User{
  21. ID: u.ID,
  22. Email: u.Email,
  23. EmailVerified: u.EmailVerified,
  24. }
  25. }