Documentation ¶
Index ¶
- type App
- func (a *App) AuthenticateGothUser(ctx context.Context, gu *goth.User) (*domain.User, error)
- func (a *App) CreateChallengeFromArgs(ctx context.Context, args domain.CreateChallengeArgs, strict bool) (*domain.Challenge, error)
- func (a *App) CreateOrUpdateUserSession(req *http.Request, user *domain.User, withOAuth bool, setActiveStatus bool) (*domain.UserSession, error)
- func (a *App) CreatePrediction(ctx context.Context, pred *domain.Prediction) (*domain.Prediction, 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) CreateUserSession(req *http.Request, user *domain.User) (*domain.UserSession, error)
- func (a *App) FilterChallenges(ctx context.Context, args *domain.FilterChallengesArgs) ([]*domain.Challenge, int, error)
- func (a *App) FilterUserChallenges(ctx context.Context, args *domain.FilterChallengesArgs) ([]*domain.Challenge, int, error)
- func (a *App) GetChallengeByContent(ctx context.Context, content string) (*domain.Challenge, error)
- func (a *App) GetChallengeByID(ctx context.Context, id uuid.UUID, userID uuid.UUID) (*domain.Challenge, error)
- func (a *App) GetChallengesByAuthor(ctx context.Context, authorID uuid.UUID, limit, offset int) ([]*domain.Challenge, int, error)
- func (a *App) GetClosingChallenges(ctx context.Context) ([]*domain.Challenge, error)
- func (a *App) GetPredictionByUserAndChallenge(ctx context.Context, userID, challengeID uuid.UUID) (*domain.Prediction, error)
- func (a *App) GetRandomFalseChallenges(ctx context.Context, limit int) ([]*domain.Challenge, error)
- func (a *App) GetRandomFinishedChallenges(ctx context.Context) ([]*domain.Challenge, error)
- func (a *App) GetRandomOngoingChallenges(ctx context.Context, userID uuid.UUID, limit int) ([]*domain.Challenge, error)
- func (a *App) GetRandomPendingChallenges(ctx context.Context) ([]*domain.Challenge, error)
- func (a *App) GetRandomTrueChallenges(ctx context.Context, limit int) ([]*domain.Challenge, error)
- func (a *App) GetSystemSummary(ctx context.Context) (*domain.SystemSymmary, error)
- func (a *App) GetUserByEmail(ctx context.Context, email string) (*domain.User, error)
- func (a *App) GetUserBySession(req *http.Request) (*domain.User, error)
- func (a *App) GetUserSummary(ctx context.Context, userID uuid.UUID) (*domain.UserSummary, error)
- func (a *App) LiveSessionID(req *http.Request) (string, error)
- func (a *App) LogoutUser(ctx context.Context) error
- func (a *App) ResetSession(res http.ResponseWriter, req *http.Request) error
- func (a *App) SetChallengeOutcome(ctx context.Context, id uuid.UUID, outcome bool, proofs []*domain.Proof) error
- func (a *App) UpdateChallengeByID(ctx context.Context, id uuid.UUID, args *domain.CreateChallengeArgs) (*domain.Challenge, error)
- func (a *App) UpdateSystemSummaryJob()
- 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 // contains filtered or unexported fields }
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) CreateChallengeFromArgs ¶
func (*App) CreateOrUpdateUserSession ¶
func (*App) CreatePrediction ¶
func (a *App) CreatePrediction(ctx context.Context, pred *domain.Prediction) (*domain.Prediction, error)
func (*App) CreateUser ¶
func (*App) CreateUserFromGoth ¶
func (*App) CreateUserSession ¶
func (*App) FilterChallenges ¶
func (*App) FilterUserChallenges ¶
func (*App) GetChallengeByContent ¶
func (*App) GetChallengeByID ¶
func (*App) GetChallengesByAuthor ¶ added in v0.0.3
func (*App) GetClosingChallenges ¶
func (*App) GetPredictionByUserAndChallenge ¶
func (*App) GetRandomFalseChallenges ¶
func (*App) GetRandomFinishedChallenges ¶
func (*App) GetRandomOngoingChallenges ¶
func (*App) GetRandomPendingChallenges ¶
func (*App) GetRandomTrueChallenges ¶
func (*App) GetSystemSummary ¶
func (*App) GetUserByEmail ¶
func (*App) GetUserBySession ¶
func (*App) GetUserSummary ¶
func (*App) ResetSession ¶ added in v0.0.3
func (*App) SetChallengeOutcome ¶
func (*App) UpdateChallengeByID ¶
func (*App) UpdateSystemSummaryJob ¶
func (a *App) UpdateSystemSummaryJob()
type Repository ¶
type Repository interface { // challenge CreateChallenge(context.Context, *domain.Challenge) (*domain.Challenge, error) UpdateChallengeByID(context.Context, *domain.Challenge) (*domain.Challenge, error) SetChallengeOutcome(ctx context.Context, id uuid.UUID, outcome bool, proofs []*domain.Proof) error CreateOrUpdateChallengeByContent(context.Context, *domain.Challenge) (*domain.Challenge, error) GetChallengeByContent(context.Context, string) (*domain.Challenge, error) GetChallengeByID(ctx context.Context, id uuid.UUID, userID uuid.UUID) (*domain.Challenge, error) GetRandomFinishedChallenges(ctx context.Context, limit int) ([]*domain.Challenge, error) GetRandomOngoingChallenges(ctx context.Context, limit int, userID uuid.UUID) ([]*domain.Challenge, error) GetClosingChallenges(ctx context.Context, limit int) ([]*domain.Challenge, error) GetRandomPendingChallenges(ctx context.Context, limit int) ([]*domain.Challenge, error) FilterUserChallenges(ctx context.Context, args *domain.FilterChallengesArgs) ([]*domain.Challenge, int, error) FilterChallenges(context.Context, *domain.FilterChallengesArgs) ([]*domain.Challenge, int, error) GetRandomTrueChallenges(ctx context.Context, limit int) ([]*domain.Challenge, error) GetRandomFalseChallenges(ctx context.Context, limit int) ([]*domain.Challenge, error) GetChallengesByAuthor(ctx context.Context, authorID uuid.UUID, limit, offset int) ([]*domain.Challenge, int, error) // 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) GetUserSummary(ctx context.Context, userID uuid.UUID) (*domain.UserSummary, error) // user session IfSessionRegistered(context.Context, *domain.UserSession) (bool, error) CreateUserSession(context.Context, *domain.UserSession) (*domain.UserSession, error) CreateOrUpdateUserSession(context.Context, *domain.UserSession) (*domain.UserSession, error) UpdateUserSessionLastActivityBySID(context.Context, string) error GetUserBySession(context.Context, *domain.UserSession) (*domain.User, error) // badge CreateOrUpdateBadgeByType(context.Context, *domain.Badge) (*domain.Badge, error) // prediction CreatePrediction(context.Context, *domain.Prediction) (*domain.Prediction, error) GetPredictionByUserAndChallenge(ctx context.Context, userID, challengeID uuid.UUID) (*domain.Prediction, error) // for system summary GetChallengeCount(ctx context.Context) (int, error) GetOngoingChallengeCount(ctx context.Context) (int, error) GetFinishedChallengeCount(ctx context.Context) (int, error) GetUserCount(ctx context.Context) (int, error) GetPredictionCount(ctx context.Context) (int, error) }
Click to show internal directories.
Click to hide internal directories.