Documentation ¶
Index ¶
- Constants
- func Errorf(code ErrorCode, format string, a ...interface{}) error
- type AccessToken
- type AccessTokenCaller
- type AuthRepository
- type AuthService
- type Class
- type ClassRepository
- type ClassService
- func (s *ClassService) Create(ctx context.Context, name string) error
- func (s *ClassService) CreateQuizClassVisibility(ctx context.Context, quizSha1 string, classId uuid.UUID) error
- func (s *ClassService) Delete(ctx context.Context, id uuid.UUID) error
- func (s *ClassService) DeleteQuizClassVisibility(ctx context.Context, quizSha1 string, classId uuid.UUID) error
- func (s *ClassService) FindAllClasses(ctx context.Context, limit uint16, offset uint16) ([]*Class, uint32, error)
- func (s *ClassService) Update(ctx context.Context, class *Class) error
- type CodeError
- type ErrorCode
- type HealthRepository
- type HealthService
- type MaintenanceRepository
- type MaintenanceService
- type Quiz
- type QuizInfos
- type QuizQuestion
- type QuizQuestionAnswer
- type QuizRepository
- type QuizService
- func (s *QuizService) AddSessionAnswer(ctx context.Context, sessionUuid uuid.UUID, userId string, questionSha1 string, ...) error
- func (s *QuizService) FindAllActive(ctx context.Context, userId string, limit uint16, offset uint16) ([]*Quiz, uint32, error)
- func (s *QuizService) FindAllQuizSessions(ctx context.Context, userId string, classId string, limit uint16, ...) ([]*QuizSession, uint32, error)
- func (s *QuizService) FindAllSessions(ctx context.Context, quizActive bool, userId string, limit uint16, ...) ([]*Session, uint32, error)
- func (s *QuizService) FindFullBySha1(ctx context.Context, sha1 string, userId string) (*Quiz, error)
- func (s *QuizService) FindQuizSessionByUuid(ctx context.Context, sessionUuid uuid.UUID) (*QuizSessionDetail, error)
- func (s *QuizService) Parse(filename string, content string) (*Quiz, error)
- func (s *QuizService) SaveQuiz(ctx context.Context, quiz *Quiz) (*SyncStats, error)
- func (s *QuizService) ScanGitRepo() ([]*Quiz, error)
- func (s *QuizService) StartSession(ctx context.Context, userId string, quizSha1 string) (uuid.UUID, error)
- func (s *QuizService) Sync(ctx context.Context) error
- type QuizSession
- type QuizSessionDetail
- type Role
- type Session
- type SessionResult
- type SyncStats
- type TokenProvenance
- type User
- type UserRepository
- type UserService
- func (s *UserService) ActivateUser(ctx context.Context, id string) error
- func (s *UserService) AssignUserToClass(ctx context.Context, userId string, classId uuid.UUID) error
- func (s *UserService) DeactivateUser(ctx context.Context, id string) error
- func (s *UserService) FindAllUser(ctx context.Context) ([]*User, error)
- func (s *UserService) FindUserById(ctx context.Context, id string) (*User, error)
- func (s *UserService) UpdateUserRole(ctx context.Context, userId string, role Role) error
- type UserSession
Constants ¶
View Source
const ( UnexpectedError = 0 UnAuthorized = 1 InvalidArgument = 2 NotFound = 3 )
View Source
const ( Cache = 1 Api = 2 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AccessToken ¶
type AccessTokenCaller ¶
type AccessTokenCaller interface {
Get(ctx context.Context, token string) (*AccessToken, error)
}
type AuthRepository ¶
type AuthRepository interface { CacheToken(token *AccessToken) error FindTokenByTokenStr(tokenStr string) (*AccessToken, error) }
type AuthService ¶
type AuthService struct {
// contains filtered or unexported fields
}
func NewAuthService ¶
func NewAuthService(authRepository AuthRepository, userRepository UserRepository, c AccessTokenCaller) AuthService
func (*AuthService) ValidateTokenAndGetUser ¶
type ClassRepository ¶
type ClassRepository interface { FindAll(ctx context.Context, limit uint16, offset uint16) ([]*Class, error) CountAll(ctx context.Context) (uint32, error) CreateOrReplace(ctx context.Context, class *Class) error Delete(ctx context.Context, classId uuid.UUID) error ExistsById(ctx context.Context, classId uuid.UUID) bool CreateQuizClassVisibility(ctx context.Context, quizSha1 string, classId uuid.UUID) error DeleteQuizClassVisibility(ctx context.Context, quizSha1 string, classId uuid.UUID) error }
type ClassService ¶
type ClassService struct {
// contains filtered or unexported fields
}
func NewClassService ¶
func NewClassService(classRepository ClassRepository) ClassService
func (*ClassService) CreateQuizClassVisibility ¶
func (*ClassService) DeleteQuizClassVisibility ¶
func (*ClassService) FindAllClasses ¶
type HealthRepository ¶
type HealthService ¶
type HealthService struct {
// contains filtered or unexported fields
}
func NewHealthService ¶
func NewHealthService(healthRepository HealthRepository) HealthService
type MaintenanceRepository ¶
type MaintenanceService ¶
type MaintenanceService struct {
// contains filtered or unexported fields
}
func NewMaintenanceService ¶
func NewMaintenanceService(r MaintenanceRepository) MaintenanceService
func (*MaintenanceService) Dump ¶
func (s *MaintenanceService) Dump() (string, error)
type Quiz ¶
type Quiz struct { Sha1 string Filename string Name string Version int CreatedAt string Active bool Duration int Questions map[string]QuizQuestion Classes map[uuid.UUID]string }
func (*Quiz) GetQuestions ¶
func (q *Quiz) GetQuestions() map[string]QuizQuestion
type QuizInfos ¶
type QuizInfos interface { GetSha1NameAndDuration() (string, string, int) GetQuestions() map[string]QuizQuestion }
type QuizQuestion ¶
type QuizQuestionAnswer ¶
type QuizRepository ¶
type QuizRepository interface { FindFullBySha1(ctx context.Context, sha1 string, userId string) (*Quiz, error) FindLatestVersionByFilename(ctx context.Context, filename string) (*Quiz, error) FindAllActive(ctx context.Context, userId string, limit uint16, offset uint16) ([]*Quiz, error) CountAllActive(ctx context.Context, userId string) (uint32, error) Create(ctx context.Context, quiz *Quiz) error ActivateOnlyVersion(ctx context.Context, filename string, version int) error FindAllSessions(ctx context.Context, quizActive bool, userId string, limit uint16, offset uint16) ([]*Session, error) CountAllSessions(ctx context.Context, quizActive bool, userId string) (uint32, error) StartSession(ctx context.Context, userId string, quizSha1 string) (uuid.UUID, error) AddSessionAnswer(ctx context.Context, sessionUuid uuid.UUID, questionSha1 string, answerSha1 string, checked bool) error FindAllQuizSessions(ctx context.Context, userId string, classId string, limit uint16, offset uint16) ([]*QuizSession, error) FindQuizSessionByUuid(ctx context.Context, sessionUuid uuid.UUID) (*QuizSessionDetail, error) }
type QuizService ¶
type QuizService struct {
// contains filtered or unexported fields
}
func NewQuizService ¶
func NewQuizService(r QuizRepository) QuizService
func (*QuizService) AddSessionAnswer ¶
func (*QuizService) FindAllActive ¶
func (*QuizService) FindAllQuizSessions ¶
func (s *QuizService) FindAllQuizSessions(ctx context.Context, userId string, classId string, limit uint16, offset uint16) ([]*QuizSession, uint32, error)
func (*QuizService) FindAllSessions ¶
func (*QuizService) FindFullBySha1 ¶
func (*QuizService) FindQuizSessionByUuid ¶
func (s *QuizService) FindQuizSessionByUuid(ctx context.Context, sessionUuid uuid.UUID) (*QuizSessionDetail, error)
func (*QuizService) Parse ¶
func (s *QuizService) Parse(filename string, content string) (*Quiz, error)
Parse parse the content of a quiz file
func (*QuizService) ScanGitRepo ¶
func (s *QuizService) ScanGitRepo() ([]*Quiz, error)
func (*QuizService) StartSession ¶
type QuizSession ¶
type QuizSessionDetail ¶
type QuizSessionDetail struct { SessionId uuid.UUID UserId string RemainingSec int Result *SessionResult QuizSha1 string Name string QuizDuration int Questions map[string]QuizQuestion }
func (*QuizSessionDetail) GetQuestions ¶
func (qd *QuizSessionDetail) GetQuestions() map[string]QuizQuestion
func (*QuizSessionDetail) GetSha1NameAndDuration ¶
func (qd *QuizSessionDetail) GetSha1NameAndDuration() (string, string, int)
type SessionResult ¶
type TokenProvenance ¶
type TokenProvenance int8
type UserRepository ¶
type UserRepository interface { FindActiveUserById(ctx context.Context, id string) (*User, error) FindUserById(ctx context.Context, id string) (*User, error) FindAllUser(ctx context.Context) ([]*User, error) CreateOrReplaceUser(ctx context.Context, user *User) error UpdateUserActive(ctx context.Context, id string, active bool) error UpdateUserRole(ctx context.Context, userId string, role Role) error UpdateUserInfo(ctx context.Context, user *User) error AssignUserToClass(ctx context.Context, userId string, classId uuid.UUID) error }
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
func NewUserService ¶
func NewUserService(userRepository UserRepository) UserService
func (*UserService) ActivateUser ¶
func (s *UserService) ActivateUser(ctx context.Context, id string) error
func (*UserService) AssignUserToClass ¶
func (*UserService) DeactivateUser ¶
func (s *UserService) DeactivateUser(ctx context.Context, id string) error
func (*UserService) FindAllUser ¶
func (s *UserService) FindAllUser(ctx context.Context) ([]*User, error)
func (*UserService) FindUserById ¶
func (*UserService) UpdateUserRole ¶
type UserSession ¶
Click to show internal directories.
Click to hide internal directories.