Documentation ¶
Index ¶
- type IdeaStorage
- func (s *IdeaStorage) Add(title, description string, userID int) (*models.Idea, error)
- func (s *IdeaStorage) AddComment(number int, content string, userID int) (int, error)
- func (s *IdeaStorage) AddSupporter(number, userID int) error
- func (s *IdeaStorage) GetAll() ([]*models.Idea, error)
- func (s *IdeaStorage) GetByID(ideaID int) (*models.Idea, error)
- func (s *IdeaStorage) GetByNumber(number int) (*models.Idea, error)
- func (s *IdeaStorage) GetCommentsByIdea(number int) ([]*models.Comment, error)
- func (s *IdeaStorage) RemoveSupporter(number, userID int) error
- func (s *IdeaStorage) SetResponse(number int, text string, userID, status int) error
- func (s *IdeaStorage) SupportedBy(userID int) ([]int, error)
- func (s *IdeaStorage) Update(number int, title, description string) (*models.Idea, error)
- type TenantStorage
- func (s *TenantStorage) Activate(id int) error
- func (s *TenantStorage) Add(name string, subdomain string, status int) (*models.Tenant, error)
- func (s *TenantStorage) FindVerificationByKey(key string) (*models.SignInRequest, error)
- func (s *TenantStorage) First() (*models.Tenant, error)
- func (s *TenantStorage) GetByDomain(domain string) (*models.Tenant, error)
- func (s *TenantStorage) IsSubdomainAvailable(subdomain string) (bool, error)
- func (s *TenantStorage) SaveVerificationKey(key string, duration time.Duration, email, name string) error
- func (s *TenantStorage) SetCurrentTenant(tenant *models.Tenant)
- func (s *TenantStorage) SetKeyAsVerified(key string) error
- func (s *TenantStorage) UpdateSettings(settings *models.UpdateTenantSettings) error
- type UserStorage
- func (s *UserStorage) ChangeRole(userID int, role models.Role) error
- func (s *UserStorage) GetAll() ([]*models.User, error)
- func (s *UserStorage) GetByEmail(tenantID int, email string) (*models.User, error)
- func (s *UserStorage) GetByID(userID int) (*models.User, error)
- func (s *UserStorage) GetByProvider(tenantID int, provider string, uid string) (*models.User, error)
- func (s *UserStorage) Register(user *models.User) error
- func (s *UserStorage) RegisterProvider(userID int, provider *models.UserProvider) error
- func (s *UserStorage) Update(userID int, settings *models.UpdateUserSettings) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IdeaStorage ¶
type IdeaStorage struct {
// contains filtered or unexported fields
}
IdeaStorage contains read and write operations for ideas
func NewIdeaStorage ¶
func NewIdeaStorage(tenant *models.Tenant, trx *dbx.Trx) *IdeaStorage
NewIdeaStorage creates a new IdeaStorage
func (*IdeaStorage) AddComment ¶
AddComment places a new comment on an idea
func (*IdeaStorage) AddSupporter ¶
func (s *IdeaStorage) AddSupporter(number, userID int) error
AddSupporter adds user to idea list of supporters
func (*IdeaStorage) GetAll ¶
func (s *IdeaStorage) GetAll() ([]*models.Idea, error)
GetAll returns all tenant ideas
func (*IdeaStorage) GetByID ¶
func (s *IdeaStorage) GetByID(ideaID int) (*models.Idea, error)
GetByID returns idea by given id
func (*IdeaStorage) GetByNumber ¶
func (s *IdeaStorage) GetByNumber(number int) (*models.Idea, error)
GetByNumber returns idea by tenant and number
func (*IdeaStorage) GetCommentsByIdea ¶
func (s *IdeaStorage) GetCommentsByIdea(number int) ([]*models.Comment, error)
GetCommentsByIdea returns all coments from given idea
func (*IdeaStorage) RemoveSupporter ¶
func (s *IdeaStorage) RemoveSupporter(number, userID int) error
RemoveSupporter removes user from idea list of supporters
func (*IdeaStorage) SetResponse ¶
func (s *IdeaStorage) SetResponse(number int, text string, userID, status int) error
SetResponse changes current idea response
func (*IdeaStorage) SupportedBy ¶
func (s *IdeaStorage) SupportedBy(userID int) ([]int, error)
SupportedBy returns a list of Idea ID supported by given user
type TenantStorage ¶
type TenantStorage struct {
// contains filtered or unexported fields
}
TenantStorage contains read and write operations for tenants
func NewTenantStorage ¶
func NewTenantStorage(trx *dbx.Trx) *TenantStorage
NewTenantStorage creates a new TenantStorage
func (*TenantStorage) Activate ¶ added in v0.6.0
func (s *TenantStorage) Activate(id int) error
Activate given tenant
func (*TenantStorage) FindVerificationByKey ¶ added in v0.6.0
func (s *TenantStorage) FindVerificationByKey(key string) (*models.SignInRequest, error)
FindVerificationByKey based on current tenant
func (*TenantStorage) First ¶
func (s *TenantStorage) First() (*models.Tenant, error)
First returns first tenant
func (*TenantStorage) GetByDomain ¶
func (s *TenantStorage) GetByDomain(domain string) (*models.Tenant, error)
GetByDomain returns a tenant based on its domain
func (*TenantStorage) IsSubdomainAvailable ¶
func (s *TenantStorage) IsSubdomainAvailable(subdomain string) (bool, error)
IsSubdomainAvailable returns true if subdomain is available to use
func (*TenantStorage) SaveVerificationKey ¶ added in v0.6.0
func (s *TenantStorage) SaveVerificationKey(key string, duration time.Duration, email, name string) error
SaveVerificationKey used by e-mail verification process
func (*TenantStorage) SetCurrentTenant ¶ added in v0.6.0
func (s *TenantStorage) SetCurrentTenant(tenant *models.Tenant)
SetCurrentTenant tenant
func (*TenantStorage) SetKeyAsVerified ¶ added in v0.6.0
func (s *TenantStorage) SetKeyAsVerified(key string) error
SetKeyAsVerified so that it cannot be used anymore
func (*TenantStorage) UpdateSettings ¶ added in v0.4.0
func (s *TenantStorage) UpdateSettings(settings *models.UpdateTenantSettings) error
UpdateSettings of given tenant
type UserStorage ¶
type UserStorage struct {
// contains filtered or unexported fields
}
UserStorage is used for user operations using a Postgres database
func NewUserStorage ¶
func NewUserStorage(tenant *models.Tenant, trx *dbx.Trx) *UserStorage
NewUserStorage creates a new UserStorage
func (*UserStorage) ChangeRole ¶ added in v0.7.0
func (s *UserStorage) ChangeRole(userID int, role models.Role) error
ChangeRole of given user
func (*UserStorage) GetAll ¶ added in v0.7.0
func (s *UserStorage) GetAll() ([]*models.User, error)
GetAll return all users of current tenant
func (*UserStorage) GetByEmail ¶
GetByEmail returns a user based on given email
func (*UserStorage) GetByID ¶
func (s *UserStorage) GetByID(userID int) (*models.User, error)
GetByID returns a user based on given id
func (*UserStorage) GetByProvider ¶ added in v0.4.0
func (s *UserStorage) GetByProvider(tenantID int, provider string, uid string) (*models.User, error)
GetByProvider returns a user based on provider details
func (*UserStorage) Register ¶
func (s *UserStorage) Register(user *models.User) error
Register creates a new user based on given information
func (*UserStorage) RegisterProvider ¶
func (s *UserStorage) RegisterProvider(userID int, provider *models.UserProvider) error
RegisterProvider adds given provider to userID
func (*UserStorage) Update ¶ added in v0.6.0
func (s *UserStorage) Update(userID int, settings *models.UpdateUserSettings) error
Update user settings