account

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 2, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	AccountID    uuid.UUID    `json:"accountID" gorm:"primary_key"`
	Email        string       `json:"email"`
	Password     string       `json:"password"`
	Username     string       `json:"username"`
	IsConfirmed  bool         `json:"isConfirmed"`
	CreatedAt    time.Time    `json:"createdAt"`
	UpdatedAt    time.Time    `json:"updatedAt"`
	Companies    []Company    `gorm:"many2many:account_company;association_jointable_foreignkey:company_id;jointable_foreignkey:account_id"`       // nolint
	Repositories []Repository `gorm:"many2many:account_repository;association_jointable_foreignkey:repository_id;jointable_foreignkey:account_id"` // nolint
}

nolint

func (*Account) GetTable

func (a *Account) GetTable() string

func (*Account) IsAccountConfirmed

func (a *Account) IsAccountConfirmed() error

func (*Account) SetAccountData

func (a *Account) SetAccountData() *Account

func (*Account) SetAccountID

func (a *Account) SetAccountID()

func (*Account) SetCreatedAt

func (a *Account) SetCreatedAt()

func (*Account) SetIsConfirmed

func (a *Account) SetIsConfirmed() *Account

func (*Account) SetPasswordHash

func (a *Account) SetPasswordHash()

func (*Account) SetUpdatedAt

func (a *Account) SetUpdatedAt() *Account

func (*Account) ToBytes

func (a *Account) ToBytes() []byte

func (*Account) ToLoginResponse

func (a *Account) ToLoginResponse(accessToken, refreshToken string, expiresAt time.Time) *LoginResponse

func (*Account) ToMap

func (a *Account) ToMap() map[string]interface{}

func (*Account) Validate

func (a *Account) Validate() error

type ClaimsJWT

type ClaimsJWT struct {
	Email            string            `json:"email"`
	Username         string            `json:"username"`
	RepositoriesRole map[string]string `json:"permissions"`
	jwt.StandardClaims
}

func (*ClaimsJWT) Valid

func (c *ClaimsJWT) Valid() error

type Company

type Company struct {
	CompanyID   uuid.UUID `json:"companyID" gorm:"primary_key" swaggerignore:"true"`
	Name        string    `json:"name"`
	Description string    `json:"description"`
	CreatedAt   time.Time `json:"createdAt" swaggerignore:"true"`
	UpdatedAt   time.Time `json:"updatedAt" swaggerignore:"true"`
}

nolint

func (*Company) GetTable

func (c *Company) GetTable() string

func (*Company) SetCreateData

func (c *Company) SetCreateData() *Company

func (*Company) SetUpdateData

func (c *Company) SetUpdateData() *Company

func (*Company) ToBytes

func (c *Company) ToBytes() []byte

func (*Company) ToCompanyResponse

func (c *Company) ToCompanyResponse(role rolesEnum.Role) *CompanyResponse

func (*Company) Validate

func (c *Company) Validate() error

type CompanyResponse

type CompanyResponse struct {
	CompanyID   uuid.UUID      `json:"companyID"`
	Name        string         `json:"name"`
	Role        rolesEnum.Role `json:"role"`
	Description string         `json:"description"`
	CreatedAt   time.Time      `json:"createdAt"`
	UpdatedAt   time.Time      `json:"updatedAt"`
}

type CreateAccount

type CreateAccount struct {
	Email    string `json:"email"`
	Password string `json:"password"`
	Username string `json:"username"`
}

func (*CreateAccount) ToAccount

func (c *CreateAccount) ToAccount() *Account

type EmailData

type EmailData struct {
	Email string `json:"email"`
}

type InviteUser

type InviteUser struct {
	Role         accountEnums.Role `json:"role"`
	Email        string            `json:"email"`
	RepositoryID uuid.UUID         `json:"repositoryID" swaggerignore:"true"`
	CompanyID    uuid.UUID         `json:"companyID" swaggerignore:"true"`
}

func (*InviteUser) SetInviteUserCompanyID

func (i *InviteUser) SetInviteUserCompanyID(companyID uuid.UUID) *InviteUser

func (*InviteUser) SetInviteUserRepositoryAndCompanyID

func (i *InviteUser) SetInviteUserRepositoryAndCompanyID(companyID, repositoryID uuid.UUID) *InviteUser

func (*InviteUser) ToAccountRepository

func (i *InviteUser) ToAccountRepository(accountID uuid.UUID) *roles.AccountRepository

func (*InviteUser) Validate

func (i *InviteUser) Validate() error

type LoginData

type LoginData struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

func (*LoginData) IsInvalid

func (l *LoginData) IsInvalid(email, passwordHash string) bool

func (*LoginData) ToBytes

func (l *LoginData) ToBytes() []byte

func (*LoginData) Validate

func (l *LoginData) Validate() error

type LoginResponse

type LoginResponse struct {
	AccessToken  string    `json:"accessToken"`
	RefreshToken string    `json:"refreshToken"`
	Username     string    `json:"username"`
	Email        string    `json:"email"`
	ExpiresAt    time.Time `json:"expiresAt"`
}

type RemoveUser

type RemoveUser struct {
	AccountID    uuid.UUID `json:"accountID"`
	CompanyID    uuid.UUID `json:"companyID"`
	RepositoryID uuid.UUID `json:"repositoryID"`
}

func (*RemoveUser) SetAccountAndCompanyID

func (r *RemoveUser) SetAccountAndCompanyID(accountID, companyID uuid.UUID) *RemoveUser

func (*RemoveUser) SetAccountAndRepositoryID

func (r *RemoveUser) SetAccountAndRepositoryID(accountID, repositoryID uuid.UUID) *RemoveUser

type Repository

type Repository struct {
	RepositoryID uuid.UUID `json:"repositoryID" gorm:"primary_key" swaggerignore:"true"`
	CompanyID    uuid.UUID `json:"companyID" swaggerignore:"true"`
	Name         string    `json:"name"`
	Description  string    `json:"description"`
	CreatedAt    time.Time `json:"createdAt" swaggerignore:"true"`
	UpdatedAt    time.Time `json:"updatedAt" swaggerignore:"true"`
}

func (*Repository) GetTable

func (r *Repository) GetTable() string

func (*Repository) SetCreateData

func (r *Repository) SetCreateData(companyID uuid.UUID) *Repository

func (*Repository) SetUpdateData

func (r *Repository) SetUpdateData(name, description string) *Repository

func (*Repository) ToAccountRepository

func (r *Repository) ToAccountRepository(role accountEnum.Role, accountID uuid.UUID) *roles.AccountRepository

func (*Repository) ToRepositoryResponse

func (r *Repository) ToRepositoryResponse(role accountEnum.Role) *RepositoryResponse

func (*Repository) Validate

func (r *Repository) Validate() error

type RepositoryResponse

type RepositoryResponse struct {
	CompanyID    uuid.UUID        `json:"companyID"`
	RepositoryID uuid.UUID        `json:"repositoryID"`
	Name         string           `json:"name"`
	Role         accountEnum.Role `json:"role"`
	Description  string           `json:"description"`
	CreatedAt    time.Time        `json:"createdAt"`
	UpdatedAt    time.Time        `json:"updatedAt"`
}

type ResetCodeData

type ResetCodeData struct {
	Email string `json:"email"`
	Code  string `json:"code"`
}

func (*ResetCodeData) Validate

func (r *ResetCodeData) Validate() error

type ValidateUnique added in v1.0.1

type ValidateUnique struct {
	Email    string `json:"email"`
	Username string `json:"username"`
}

func (*ValidateUnique) Validate added in v1.0.1

func (v *ValidateUnique) Validate() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL