Documentation
¶
Index ¶
- Constants
- func AbstractExists(team *models.DashboardTeam, event string) bool
- func AbstractPath(teamId int, event string) (string, bool)
- func AbstractUploadedAt(teamId int, event string) time.Time
- func BadRequestError(c echo.Context, msg string, err *error) error
- func ForbiddenError(c echo.Context, msg string, err *error) error
- func GetAbstractFile(strTeamId string) (string, error)
- func GetAllotmentCSV(userId int, event string) (string, error)
- func GetSession(c echo.Context) (*sessions.Session, error)
- func InternalError(c echo.Context, msg string, err *error) error
- func InvalidateSession(c echo.Context) error
- func IsPDF(file *multipart.FileHeader) bool
- func NormaliseProjectLinks(githubRaw string, videoRaw string) (string, string, error)
- func SaveAbstract(file *multipart.FileHeader, event dao.Event, teamId int) error
- func SaveMidTermCSV(file *multipart.FileHeader, userId int, event string) error
- func SetSession(c echo.Context, maxAge Age, values *map[Key]interface{}) error
- func SetSessionWith(sess *sessions.Session, c echo.Context, maxAge Age, ...) error
- func UnauthorizedError(c echo.Context, msg string, err *error) error
- func UploadMidTermScores(userId int, event string) error
- type Age
- type Key
- type ProjectLinkError
Constants ¶
const ( UserSessionKey Key = "u" TokenSessionKey Key = "at" StateSessionKey Key = "state" SessionTempAge Age = 60 * 15 // 15 minutes SessionMaxAge Age = 86400 * 2 // 2 days )
const MaxProjectLinkLength = 500
MaxProjectLinkLength caps what we store. Real GitHub and Drive links are far shorter; the limit exists so a pasted essay can't fill a row.
Variables ¶
This section is empty.
Functions ¶
func AbstractExists ¶
func AbstractExists(team *models.DashboardTeam, event string) bool
func AbstractPath ¶
AbstractPath returns where a team's abstract for an event lives, and whether that file actually exists. Anything that links to a PDF must gate on the boolean: the abstract table records a submission, but the file can be gone.
func AbstractUploadedAt ¶
AbstractUploadedAt returns when a team's abstract file was last written, or the zero time when there is none.
func ForbiddenError ¶
ForbiddenError is for a signed-in person asking for something the server deliberately refuses - a closed submission window, for example. It is not a client mistake, so it must not read as a 400.
func GetAbstractFile ¶
GetAbstractFile finds a team's abstract file. Only the three events with an abstract round are searched; Logical Rhythm has none, so nothing can exist under files/abstracts/logical.
func InvalidateSession ¶
func IsPDF ¶
func IsPDF(file *multipart.FileHeader) bool
IsPDF checks the upload really is a PDF by its first bytes, not its name.
func NormaliseProjectLinks ¶
NormaliseProjectLinks cleans and checks a team's final submission: a GitHub repository link and a Google Drive link to a short demo video. Both are required. It returns the links in the form they should be stored, or a message written for the person who typed them.
func SaveAbstract ¶
func SaveMidTermCSV ¶
func SaveMidTermCSV(file *multipart.FileHeader, userId int, event string) error
func SetSessionWith ¶
func UploadMidTermScores ¶
Types ¶
type ProjectLinkError ¶
func (*ProjectLinkError) Error ¶
func (e *ProjectLinkError) Error() string