Documentation ¶
Index ¶
- Constants
- Variables
- type Account
- type AccountMailHistory
- type AccountRepository
- type AccountService
- type AuthRepository
- type AuthResponse
- type AuthService
- type Base
- type Operator
- type OperatorRepository
- type OperatorService
- type Permissions
- type Phone
- type PhoneRepository
- type PhoneService
- type Profile
- type ProfileRepository
- type ProfileService
- type Site
- type SiteRepository
- type SiteService
- type TokensResponse
- type User
- type UserRepository
- type UserService
Constants ¶
View Source
const ( AccountTableName string = "account" AccountMailsTableName string = "account_mail_history" )
View Source
const ( PhoneTableName string = "phone" OperatorTableName string = "operator" )
View Source
const ProfileTableName string = "profiles"
View Source
const SiteTableName string = "site"
View Source
const UserTableName string = "users"
Variables ¶
View Source
var ErrInvalidIpAssociation error = errors.New("invalid ip source")
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { Base Username string `json:"username" gorm:"column:username;type:varchar(100);index;not null;" validate:"required,min=2"` Password string `json:"-" gorm:"column:password;type:varchar(100);index;not null;" validate:"required,min=2"` SiteID uint `json:"-" gorm:"column:site_id;type:bigint;not null;index;" validate:"required,min=1"` Site *Site `json:"site,omitempty"` PhoneID uint `json:"-" gorm:"column:phone_id;type:bigint;not null;index;" validate:"required,min=1"` Phone *Phone `json:"phone,omitempty"` MailID uint `json:"-" gorm:"column:mail_id;type:bigint;index;default:null;"` Mail *Account `json:"mail,omitempty"` UserID uint `json:"-" gorm:"column:user_id;type:bigint;not null;index;" validate:"required,min=1"` User *User `json:"-"` }
func (*Account) DecodePass ¶
func (*Account) EncodePass ¶
func (s *Account) EncodePass()
type AccountMailHistory ¶
type AccountMailHistory struct { Base AccountID uint `json:"-" gorm:"column:account_id;type:bigint;not null;index;" validate:"required,min=1"` Account *Account `json:"account,omitempty"` MailID uint `json:"-" gorm:"column:mail_id;type:bigint;not null;index;" validate:"required,min=1"` Mail *Account `json:"mail,omitempty"` }
func (AccountMailHistory) TableName ¶
func (AccountMailHistory) TableName() string
type AccountRepository ¶
type AccountRepository interface { GetAccountByID(context.Context, uint, uint) (*Account, error) GetAccountsOutputDTO(context.Context, *filter.Filter, uint) (*dto.ItemsOutputDTO, error) CreateAccount(context.Context, *dto.AccountInputDTO, uint) (*Account, error) UpdateAccount(context.Context, *Account, *dto.AccountInputDTO, uint) (*Account, error) DeleteAccount(context.Context, *Account, uint) error }
type AccountService ¶
type AccountService interface { GetAccountByID(context.Context, uint, uint) (*Account, error) GetAccountsOutputDTO(context.Context, *filter.Filter, uint) (*dto.ItemsOutputDTO, error) CreateAccount(context.Context, *dto.AccountInputDTO, uint) (*Account, error) UpdateAccount(context.Context, *Account, *dto.AccountInputDTO, uint) (*Account, error) DeleteAccount(context.Context, *Account, uint) error }
type AuthRepository ¶
type AuthResponse ¶
type AuthResponse struct { User *User `json:"user"` TokensResponse }
type AuthService ¶
type Operator ¶
type OperatorRepository ¶
type OperatorRepository interface { GetOperatorByID(context.Context, uint) (*Operator, error) GetOperatorsOutputDTO(context.Context, *filter.Filter) (*dto.ItemsOutputDTO, error) CreateOperator(context.Context, *dto.OperatorInputDTO) (*Operator, error) UpdateOperator(context.Context, *Operator, *dto.OperatorInputDTO) error DeleteOperator(context.Context, *Operator) error }
type OperatorService ¶
type OperatorService interface { GetOperatorByID(context.Context, uint) (*Operator, error) GetOperatorsOutputDTO(context.Context, *filter.Filter) (*dto.ItemsOutputDTO, error) CreateOperator(context.Context, *dto.OperatorInputDTO) (*Operator, error) UpdateOperator(context.Context, *Operator, *dto.OperatorInputDTO) error DeleteOperator(context.Context, *Operator) error }
type Permissions ¶
type Permissions struct { Id uint `json:"-" gorm:"primarykey"` ProfileID uint `json:"-" gorm:"column:profile_id;unique;"` UserModule bool `json:"user_module" gorm:"column:user;type:bool;not null;"` ProfileModule bool `json:"profile_module" gorm:"column:profile;type:bool;not null;"` }
func (*Permissions) ToMap ¶
func (s *Permissions) ToMap() *map[string]interface{}
type Phone ¶
type PhoneRepository ¶
type PhoneRepository interface { GetPhoneByID(context.Context, uint) (*Phone, error) GetPhonesOutputDTO(context.Context, *filter.Filter) (*dto.ItemsOutputDTO, error) CreatePhone(context.Context, *dto.PhoneInputDTO) (*Phone, error) UpdatePhone(context.Context, *Phone, *dto.PhoneInputDTO) error DeletePhone(context.Context, *Phone) error }
type PhoneService ¶
type PhoneService interface { GetPhoneByID(context.Context, uint) (*Phone, error) GetPhonesOutputDTO(context.Context, *filter.Filter) (*dto.ItemsOutputDTO, error) CreatePhone(context.Context, *dto.PhoneInputDTO) (*Phone, error) UpdatePhone(context.Context, *Phone, *dto.PhoneInputDTO) error DeletePhone(context.Context, *Phone) error }
type Profile ¶
type Profile struct { Base Name string `json:"name" gorm:"column:name;type:varchar(100);unique;not null;" validate:"required,min=4"` Permissions Permissions `json:"permissions" gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"` }
type ProfileRepository ¶
type ProfileRepository interface { GetProfileByID(context.Context, uint) (*Profile, error) GetProfilesOutputDTO(context.Context, *filter.Filter) (*dto.ItemsOutputDTO, error) CreateProfile(context.Context, *dto.ProfileInputDTO) (*Profile, error) UpdateProfile(context.Context, *Profile, *dto.ProfileInputDTO) error DeleteProfile(context.Context, *Profile) error }
type ProfileService ¶
type ProfileService interface { GetProfileByID(context.Context, uint) (*Profile, error) GetProfilesOutputDTO(context.Context, *filter.Filter) (*dto.ItemsOutputDTO, error) CreateProfile(context.Context, *dto.ProfileInputDTO) (*Profile, error) UpdateProfile(context.Context, *Profile, *dto.ProfileInputDTO) error DeleteProfile(context.Context, *Profile) error }
type Site ¶
type SiteRepository ¶
type SiteRepository interface { GetSiteByID(context.Context, uint) (*Site, error) GetSitesOutputDTO(context.Context, *filter.Filter) (*dto.ItemsOutputDTO, error) CreateSite(context.Context, *dto.SiteInputDTO) (*Site, error) UpdateSite(context.Context, *Site, *dto.SiteInputDTO) error DeleteSite(context.Context, *Site) error }
type SiteService ¶
type SiteService interface { GetSiteByID(context.Context, uint) (*Site, error) GetSitesOutputDTO(context.Context, *filter.Filter) (*dto.ItemsOutputDTO, error) CreateSite(context.Context, *dto.SiteInputDTO) (*Site, error) UpdateSite(context.Context, *Site, *dto.SiteInputDTO) error DeleteSite(context.Context, *Site) error }
type TokensResponse ¶
type TokensResponse struct { AccessToken string `json:"accesstoken" validate:"jwt"` RefreshToken string `json:"refreshtoken" validate:"jwt"` }
func (*TokensResponse) Validate ¶
func (s *TokensResponse) Validate() error
type User ¶
type User struct { Base Name string `json:"name" gorm:"column:name;type:varchar(90);not null;" validate:"required,min=5"` Email string `json:"mail" gorm:"column:mail;type:varchar(50);not null;unique;index;" validate:"required,email"` Status bool `json:"status" gorm:"column:status;type:bool;not null;"` New bool `json:"new" gorm:"column:new;type:bool;not null;"` ProfileID uint `json:"-" gorm:"column:profile_id;type:bigint;not null;index;" validate:"required,min=1"` Token *string `json:"-" gorm:"column:token;type:varchar(255);unique;index"` Password *string `json:"-" gorm:"column:password;type:varchar(255);"` Profile *Profile `json:"profile,omitempty"` Expire bool `json:"-" gorm:"-"` }
func (*User) GenerateToken ¶
func (*User) ValidatePassword ¶
type UserRepository ¶
type UserRepository interface { GetUserByID(context.Context, uint) (*User, error) GetUsersOutputDTO(context.Context, *filter.UserFilter) (*dto.ItemsOutputDTO, error) GetUserByMail(context.Context, string) (*User, error) GetUserByToken(context.Context, string) (*User, error) CreateUser(context.Context, *dto.UserInputDTO) (*User, error) UpdateUser(context.Context, *User, *dto.UserInputDTO) error DeleteUser(context.Context, *User) error ResetUser(context.Context, *User) error PasswordUser(context.Context, *User, *dto.PasswordInputDTO) error }
type UserService ¶
type UserService interface { GetUserByID(context.Context, uint) (*User, error) GetUsersOutputDTO(context.Context, *filter.UserFilter) (*dto.ItemsOutputDTO, error) GetUserByMail(context.Context, string) (*User, error) GetUserByToken(context.Context, string) (*User, error) CreateUser(context.Context, *dto.UserInputDTO) (*User, error) UpdateUser(context.Context, *User, *dto.UserInputDTO) error DeleteUser(context.Context, *User) error ResetUser(context.Context, *User) error PasswordUser(context.Context, *User, *dto.PasswordInputDTO) error }
Click to show internal directories.
Click to hide internal directories.