Documentation
¶
Index ¶
- Constants
- func UserCachePrefix(userId uint) string
- func ValidateEmail(email string) error
- func ValidatePassword(password string) error
- type AlbumApp
- type AllProblemsAdminApp
- type AllProblemsApp
- type AttemptResultApp
- type AttemptResultForListApp
- type CacheKey
- type CurrentProblemsApp
- type EmailWrappedApp
- type ExpandedUserProblemAttempt
- type ExpandedUserProblemAttemptRepo
- type LoginApp
- type LoginResponseApp
- type NextProblemsApp
- type PasswordChangeApp
- type Problem
- type ProblemAdminApp
- type ProblemAdminStatsApp
- type ProblemApp
- type ProblemAttemptApp
- type ProblemAttemptsByUserApp
- type ProblemNextApp
- type ProblemRepo
- type ProblemStatsApp
- type ProblemSummaryApp
- type ProblemTag
- type ProblemTagRepo
- type ProblemsApp
- type RefreshResponseApp
- type RegistrationApp
- type School
- type SchoolApp
- type SchoolRepo
- type SchoolsApp
- type TeleOMACache
- type UpdateProfileApp
- type User
- type UserAction
- type UserActionRepo
- type UserApp
- type UserIdWrappedApp
- type UserProblemAttempt
- type UserProblemAttemptRepo
- type UserRepo
Constants ¶
View Source
const (
AnonymousUser uint = 1
)
Variables ¶
This section is empty.
Functions ¶
func UserCachePrefix ¶
func ValidateEmail ¶
func ValidatePassword ¶
Types ¶
type AlbumApp ¶
type AlbumApp struct {
Album []ProblemStatsApp `json:"album"`
}
type AllProblemsAdminApp ¶
type AllProblemsAdminApp struct {
Problems []ProblemAdminApp `json:"all_problems"`
}
type AllProblemsApp ¶
type AllProblemsApp struct {
Problems []ProblemSummaryApp `json:"all_problems"`
}
type AttemptResultApp ¶
type AttemptResultForListApp ¶
type CacheKey ¶
type CacheKey string
func ProblemCacheKey ¶
func ProblemViewableCacheKey ¶
func UserAlbumCacheKey ¶
type CurrentProblemsApp ¶
type CurrentProblemsApp struct {
CurrentProblems []ProblemApp `json:"current_problems"`
}
type EmailWrappedApp ¶
type EmailWrappedApp struct {
Email string `json:"email"`
}
type ExpandedUserProblemAttemptRepo ¶
type ExpandedUserProblemAttemptRepo interface { GetByUserId(userId uint) []ExpandedUserProblemAttempt GetByUserIdAndProblemId(userId uint, problemId uint) []ExpandedUserProblemAttempt GetAllByProblem(problemId uint) []ExpandedUserProblemAttempt }
type LoginResponseApp ¶
type LoginResponseApp struct { Token string `json:"token"` Expiration string `json:"expiration"` User UserApp `json:"user` }
Response of the successful login
type NextProblemsApp ¶
type NextProblemsApp struct {
NextProblems []ProblemNextApp `json:"next_problems"`
}
type PasswordChangeApp ¶
type Problem ¶
type Problem struct { gorm.Model PoserId uint OmaforosPostId uint DateContestStart time.Time DateContestEnd time.Time Statement string `gorm:"type:longtext;"` Answer int Annotations string `gorm:"type:longtext;"` IsDraft bool Hint string `gorm:"type:longtext;"` OfficialSolution string `gorm:"type:longtext;"` Series string NumberInSeries uint }
func (*Problem) IsContestFinished ¶
func (*Problem) IsCurrentProblem ¶
func (*Problem) IsViewable ¶
type ProblemAdminApp ¶
type ProblemAdminApp struct { ProblemId uint `json:"problem_id"` Statement string `json:"statement"` Answer int `json:"answer"` OmaforosPostId uint `json:"omaforos_post_id"` Annotations string `json:"annotations"` Hint string `json:"hint"` Series string `json:"series"` NumberInSeries uint `json:"number_in_series"` Tags []string `json:"tags"` OfficialSolution string `json:"official_solution"` ReleaseDate time.Time `json:"release_date"` Deadline time.Time `json:"deadline"` IsDraft bool `json:"is_draft"` }
func (*ProblemAdminApp) IsCurrentProblemAdminApp ¶
func (problemAdminApp *ProblemAdminApp) IsCurrentProblemAdminApp() bool
func (ProblemAdminApp) Validate ¶
func (newProblem ProblemAdminApp) Validate() error
type ProblemAdminStatsApp ¶
type ProblemAdminStatsApp struct { ProblemId uint `json:"problem_id"` Attempts uint `json:"attempts"` SolvedCount uint `json:"solved"` SolvedDistinctCount int `json:"solved_distinct"` SolvedDuringContestCount uint `json:"solved_during_contest"` IsCurrentProblem bool `json:"is_current_problem"` Series string `json:"series"` NumberInSeries uint `json:"number_in_series"` Tags []string `json:"tags"` }
type ProblemApp ¶
type ProblemApp struct { ProblemId uint `json:"problem_id"` Statement string `json:"statement"` OmaforosPostId uint `json:"omaforos_post_id"` Series string `json:"series"` NumberInSeries uint `json:"number_in_series"` Tags []string `json:"tags"` ReleaseDate time.Time `json:"release_date"` Deadline time.Time `json:"deadline"` }
type ProblemAttemptApp ¶
type ProblemAttemptsByUserApp ¶
type ProblemAttemptsByUserApp struct { ProblemId uint `json:"problem_id"` Attempts uint `json:"attempts"` IsCurrentProblem bool `json:"is_current_problem"` Solved bool `json:"solved"` SolvedDuringContest bool `json:"solved_during_contest"` DateSolved time.Time `json:"date_solved"` Deadline time.Time `json:"deadline"` AttemptList []AttemptResultForListApp `json:"attempt_list"` }
type ProblemNextApp ¶
type ProblemRepo ¶
type ProblemRepo interface { GetById(problemId uint) *Problem Create(problem *Problem) error Update(problem *Problem) error // updates a specific row, problem must have ID setted Delete(problemId uint) error // deletes a problem by Id GetCurrentProblems() []Problem // devuelve los problemas que se pueden ver y cuyo deadline es futuro (sin drafts) GetNextProblems() []Problem // devuelve los problemas que todavia no se pueden ver (sin drafts) GetAllProblems() []Problem // devuelve los problemas que ya se pueden ver (sin drafts) GetAllProblemsForAdmin() []Problem // devuelve todos los problemas incluyendo drafts y problemas que aun no son publicos GetNextNumberInSeries(series string) uint }
el numero dentro de la serie lo maneja automaticamente este repo un problema que no es draft no puede volver a ser draft
type ProblemStatsApp ¶
type ProblemStatsApp struct { ProblemId uint `json:"problem_id"` Attempts uint `json:"attempts"` Solved bool `json:"solved"` SolvedDuringContest bool `json:"solved_during_contest"` IsCurrentProblem bool `json:"is_current_problem"` DateSolved time.Time `json:"date_solved"` Series string `json:"series"` NumberInSeries uint `json:"number_in_series"` Tags []string `json:"tags"` }
type ProblemSummaryApp ¶
type ProblemTagRepo ¶
type ProblemTagRepo interface { Create(problemTag *ProblemTag) error CreateByProblemIdAndTags(problemId uint, tags []string) error DeleteAllTagsByProblemId(problemId uint) error GetByProblemId(problemId uint) []ProblemTag GetAllTags() []ProblemTag // todas, incluyendo tags de drafts y problemas privados }
type ProblemsApp ¶
type ProblemsApp struct {
Problems []ProblemSummaryApp `json:"problems"`
}
type RefreshResponseApp ¶
type RefreshResponseApp struct { Token string `json:"token"` Expiration string `json:"expiration"` }
Response of the successful refresh
type RegistrationApp ¶
type RegistrationApp struct { UserName string `json:"user_name"` Password string `json:"password"` Name string `json:"name"` LastName string `json:"last_name"` BirthDate string `json:"birth_date"` Email string `json:"email"` Gender string `json:"gender"` IsStudent bool `json:"is_student"` IsTeacher bool `json:"is_teacher"` SchoolYear uint `json:"school_year"` Country string `json:"country"` Province string `json:"province"` Department string `json:"department"` Location string `json:"location"` School string `json:"school"` }
func (RegistrationApp) Validate ¶
func (registration RegistrationApp) Validate() error
func (RegistrationApp) ValidateWithoutPassword ¶
func (registration RegistrationApp) ValidateWithoutPassword() error
validaciones para put de user profile
type SchoolRepo ¶
type SchoolsApp ¶
type SchoolsApp struct {
Problems []SchoolApp `json:"schools"`
}
type TeleOMACache ¶
type TeleOMACache interface { Get(key CacheKey) interface{} SetWithTTL(key CacheKey, value interface{}, timeToLive time.Duration) SetWithExpiration(key CacheKey, value interface{}, expirationDate time.Time) Delete(key CacheKey) Clear() int // clears everything GetUserAlbum(userId uint) interface{} ClearUserCache(userId uint) int //clears the user's cache }
type UpdateProfileApp ¶
type UpdateProfileApp struct { UserName string `json:"user_name"` Name string `json:"name"` LastName string `json:"last_name"` BirthDate string `json:"birth_date"` Email string `json:"email"` Gender string `json:"gender"` IsStudent bool `json:"is_student"` IsTeacher bool `json:"is_teacher"` SchoolYear uint `json:"school_year"` Country string `json:"country"` Province string `json:"province"` Department string `json:"department"` Location string `json:"location"` School string `json:"school"` }
everything but password
type User ¶
type User struct { gorm.Model // campos de registro de usuario UserName string `gorm:"unique;size:20"` HashedPassword string Email string `gorm:"unique;"` Name string LastName string BirthDate time.Time Gender string Country string Province string Department string Location string School string IsStudent bool IsTeacher bool SchoolYear uint // campos que se llenan de otra forma RegistrationDate time.Time LastActiveDate time.Time IsAdmin bool }
Si agregamos algun campo a este struct hay que tener mucho cuidado de no pisarlo con null en el endpoint de Update user!
type UserAction ¶
type UserActionRepo ¶
type UserActionRepo interface { GetByID(ID uint) *UserAction GetActionsByUserID(userID uint) []UserAction GetAll() []UserAction Create(user *UserAction) error }
type UserApp ¶
type UserApp struct { UserID uint `json:"user_id"` UserName string `json:"user_name"` Email string `json:"email"` Name string `json:"name"` LastName string `json:"last_name"` BirthDate time.Time `json:"birth_date"` Gender string `json:"gender"` IsStudent bool `json:"is_student"` IsTeacher bool `json:"is_teacher"` SchoolYear uint `json:"school_year"` Country string `json:"country"` Province string `json:"province"` Department string `json:"department"` Location string `json:"location"` School string `json:"school"` RegistrationDate time.Time `json:"registration_date"` IsAdmin bool `json:"is_admin"` }
type UserIdWrappedApp ¶
type UserIdWrappedApp struct {
UserId uint `json:"user_id"`
}
type UserProblemAttempt ¶
type UserProblemAttemptRepo ¶
type UserProblemAttemptRepo interface { Create(userProblemAttempt *UserProblemAttempt) error GetByProblemIdAndUserId(problemId uint, userId uint) []UserProblemAttempt }
Click to show internal directories.
Click to hide internal directories.