controller

package
v0.0.0-...-f2e39e4 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OrgController

type OrgController struct {
	// contains filtered or unexported fields
}

func NewOrgController

func NewOrgController(db OrgDB, u UserCreator) *OrgController

func (*OrgController) GetOrganisation

func (c *OrgController) GetOrganisation(id string, u auth.User) (impact.Organisation, error)

GetOrganisation returns the organisation with the given id. If the provided id is empty, the user's organisation will be assumed.

func (*OrgController) GetOrganisations

func (c *OrgController) GetOrganisations(offset, limit int, u auth.User) ([]impact.Organisation, error)

GetOrganisations returns a page of organisations. If a user has organisations:read permission, all organisations are considered, otherwise it pages within the user's organisations

func (*OrgController) NewOrganisation

func (c *OrgController) NewOrganisation(orgName, userName, email, password string) (impact.Organisation, error)

NewOrganisation creates an organisation with a single user. The provided user name, email and password is used to create the user within the new org.

func (*OrgController) UpdateOrganisationSetting

func (c *OrgController) UpdateOrganisationSetting(id, setting string, value interface{}, u auth.User) error

UpdateOrganisationSetting will update a setting associated with an organisation. If the organisation ID provided is an empty string, the user's organisation is used.

type OrgDB

type OrgDB interface {
	GetOrganisation(id string) (impact.Organisation, error)
	AddOrganisation(name string) (impact.Organisation, error)
	DeleteOrganisation(id string) error
	UpdateSetting(orgID string, setting string, value interface{}) error
	GetOrganisations(offset int, limit int) ([]impact.Organisation, error)
}

type ReportController

type ReportController struct {
	// contains filtered or unexported fields
}

func NewReportController

func NewReportController(db ReportDB) *ReportController

func (*ReportController) HasGeneratedReport

func (rc *ReportController) HasGeneratedReport(orgID string, u auth.User) (bool, error)

type ReportDB

type ReportDB interface {
	HasGeneratedReport(orgID string) (bool, error)
}

type UserController

type UserController struct {
	// contains filtered or unexported fields
}

func NewUserController

func NewUserController(ud UserDirectory) *UserController

func (*UserController) CreateUser

func (uc *UserController) CreateUser(name, email, password, orgID string) (*user.Profile, error)

func (*UserController) GetSelf

func (uc *UserController) GetSelf(u auth.User) (*user.U, error)

func (*UserController) GetUser

func (uc *UserController) GetUser(id string, u auth.User) (*user.Profile, error)

func (*UserController) GetUsers

func (uc *UserController) GetUsers(org string, u auth.User) ([]user.Profile, error)

func (*UserController) UnsubscribeUser

func (uc *UserController) UnsubscribeUser(id string) error

func (*UserController) UpdateSelf

func (uc *UserController) UpdateSelf(patch user.Patch, u auth.User) (*user.U, error)

func (*UserController) UpdateUser

func (uc *UserController) UpdateUser(id string, patch user.Patch, u auth.User) (*user.Profile, error)

type UserCreator

type UserCreator interface {
	CreateUser(name, email, password, orgID string) (user.U, error)
}

type UserDirectory

type UserDirectory interface {
	GetUser(id string) (user.U, error)
	GetOrgUsers(org string) ([]user.U, error)
	UpdateUser(id string, patch user.Patch) (user.U, error)
	CreateUser(name, email, password, orgID string) (user.U, error)
}

Jump to

Keyboard shortcuts

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