Documentation
¶
Index ¶
- type App
- func (a *App) AddError(err error)
- func (a *App) AddEvent(name string, start time.Time)
- func (a *App) AddResponse(ctx context.Context, take *domain.Take, item *domain.Item) (*domain.Take, *domain.Response, error)
- func (a *App) AuthenticateGothUser(ctx context.Context, gu *goth.User) (*domain.User, error)
- func (a *App) BeginTest(ctx context.Context, test *domain.Test) (*domain.Test, error)
- func (a *App) CreateAnonymousUser(ctx context.Context) (*domain.User, error)
- func (a *App) CreateOrUpdateTagFromArgs(ctx context.Context, args domain.CreateTagArgs) error
- func (a *App) CreateOrUpdateTestFromArgs(ctx context.Context, args domain.CreateTestArgs) error
- func (a *App) CreateOrUpdateUserSession(req *http.Request, ls live.Session, user *domain.User, setActiveStatus bool) (*domain.UserSession, error)
- func (a *App) CreateOrUpdateUserSessionWithSID(req *http.Request, sid string, user *domain.User, setActiveStatus bool) (*domain.UserSession, error)
- func (a *App) CreateUser(ctx context.Context, u *domain.User) (*domain.User, error)
- func (a *App) CreateUserFromGoth(ctx context.Context, gu *goth.User) (*domain.User, error)
- func (a *App) EndTest(ctx context.Context, test *domain.Test) (*domain.Test, error)
- func (a *App) GetSystemSummary(ctx context.Context) (*domain.SystemSummary, error)
- func (a *App) GetTags(ctx context.Context, locale string) ([]*domain.Tag, error)
- func (a *App) GetTake(ctx context.Context, takeID uuid.UUID) (*domain.Take, error)
- func (a *App) GetTestByCode(ctx context.Context, code string, locale string) (*domain.Test, error)
- func (a *App) GetTestsForLocale(ctx context.Context, args *domain.QueryTestsArgs) ([]*domain.Test, error)
- func (a *App) GetUserByEmail(ctx context.Context, email string) (*domain.User, error)
- func (a *App) GetUserBySession(req *http.Request, ls live.Session) (*domain.User, error)
- func (a *App) IsDev() bool
- func (a *App) LiveSessionID(req *http.Request) (string, error)
- func (a *App) LiveSessionIDFromSession(ls live.Session) (string, error)
- func (a *App) LogoutUser(ctx context.Context) error
- func (a *App) PrepareTest(ctx context.Context, code string, locale string, args *domain.PrepareTestArgs) (*domain.Test, error)
- func (a *App) PrepareTestResult(ctx context.Context, test *domain.Test, locale string, overrideMethod string) (*domain.Test, error)
- func (a *App) ResetSession(res http.ResponseWriter, req *http.Request) error
- func (a *App) SaveTestResults(ctx context.Context, test *domain.Test) error
- func (a *App) UpdateNorms(ctx context.Context) (errs error)
- func (a *App) UpdateSystemSummary(ctx context.Context) error
- func (a *App) UpdateTakeMark(ctx context.Context, takeID uuid.UUID, mark int) error
- func (a *App) UpdateTestDurations(ctx context.Context) error
- func (a *App) UpdateTestMarks(ctx context.Context) error
- func (a *App) UpdateUser(ctx context.Context, user *domain.User) (*domain.User, error)
- func (a *App) ValidateUserPassword(ctx context.Context, u *domain.User) (bool, error)
- type Repository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
Cfg configs.Config
Store sessions.Store
Errors []error
Events []domain.Event
// contains filtered or unexported fields
}
func (*App) AddResponse ¶
func (*App) AuthenticateGothUser ¶
AuthenticateGothUser creates new user or returns existsing one. It relies on goth authetication to verify user has access to that profile and thus doesn't check password.
func (*App) CreateAnonymousUser ¶
func (*App) CreateOrUpdateTagFromArgs ¶
func (*App) CreateOrUpdateTestFromArgs ¶
func (*App) CreateOrUpdateUserSession ¶
func (*App) CreateOrUpdateUserSessionWithSID ¶
func (*App) CreateUser ¶
func (*App) CreateUserFromGoth ¶
func (*App) GetSystemSummary ¶
func (*App) GetTestByCode ¶
func (*App) GetTestsForLocale ¶
func (*App) GetUserByEmail ¶
func (*App) GetUserBySession ¶
func (*App) LiveSessionIDFromSession ¶
func (*App) PrepareTest ¶
func (*App) PrepareTestResult ¶
func (*App) ResetSession ¶
func (*App) SaveTestResults ¶
func (*App) UpdateTakeMark ¶
func (*App) UpdateUser ¶
type Repository ¶
type Repository interface {
// user
IfEmailRegistered(context.Context, string) (bool, error)
GetUserByEmail(context.Context, string) (*domain.User, error)
GetUserByID(context.Context, uuid.UUID) (*domain.User, error)
CreateUser(context.Context, *domain.User) (*domain.User, error)
UpdateUser(ctx context.Context, user *domain.User) (*domain.User, error)
// user session
IfSessionRegistered(context.Context, *domain.UserSession) (bool, error)
CreateOrUpdateUserSession(context.Context, *domain.UserSession) (*domain.UserSession, error)
UpdateUserSessionLastActivityBySID(context.Context, string) error
GetUserBySession(context.Context, *domain.UserSession) (*domain.User, error)
// test
CreateOrUpdateTestFromArgs(context.Context, *domain.CreateTestArgs) error
GetTests(ctx context.Context, args *domain.QueryTestsArgs) ([]*domain.Test, error)
GetTestByCode(ctx context.Context, code string, locale string) (*domain.Test, error)
GetTakeData(ctx context.Context, take *domain.Take, locale string) (*domain.Test, error)
GetDataForMarkCalculation(ctx context.Context) ([]*domain.Test, error)
GetDataForDurationCalculation(ctx context.Context) ([]*domain.Test, error)
UpdateTestMark(ctx context.Context, testID uuid.UUID, mark float64) error
UpdateTestDuration(ctx context.Context, testID uuid.UUID, duration time.Duration) error
// take
GetTake(ctx context.Context, takeID uuid.UUID) (*domain.Take, error)
CreateTake(ctx context.Context, take *domain.Take) (*domain.Take, error)
UpdateTake(ctx context.Context, take *domain.Take) (*domain.Take, error)
UpdateTakeMark(ctx context.Context, takeID uuid.UUID, mark int) error
// response
AddOrUpdateResponse(ctx context.Context, takeID uuid.UUID, itm *domain.Item) (*domain.Response, error)
// sample
CreateOrUpdateSample(ctx context.Context, sample *domain.Sample) (*domain.Sample, error)
GetSamples(ctx context.Context) ([]*domain.Sample, error)
// norm
CreateOrUpdateNorm(ctx context.Context, norm *domain.Norm) (*domain.Norm, error)
GetDataForNormCalculation(ctx context.Context, criteria domain.SampleCriteria) ([]*domain.NormCalculationData, error)
GetScaleNorms(ctx context.Context, scaleID uuid.UUID, sampleIDs []uuid.UUID) ([]*domain.Norm, error)
// result
CreateOrUpdateResult(ctx context.Context, result *domain.Result) (*domain.Result, error)
// for system summary
GetUserCount(ctx context.Context) (int, error)
FinishedTakeCount(ctx context.Context) (int, error)
TestCount(ctx context.Context) (int, error)
ResponseCount(ctx context.Context) (int, error)
// tag
CreateOrUpdateTagFromArgs(ctx context.Context, args *domain.CreateTagArgs) error
GetTagsByCodes(ctx context.Context, locale string, codes ...string) ([]*domain.Tag, error)
GetTagIDsByCodes(ctx context.Context, codes ...string) ([]uuid.UUID, error)
}
Click to show internal directories.
Click to hide internal directories.