// GET REQUESTS -------------------------------------------------------------------------------------- func getScoreboard(ctx *web.Context) string { scoreBoard := domains.Scoreboard{} scoreBoard.Scores = make([]domains.UsersPublicFlagInfo, 0) users, err := db.GetPublicUsers() if err != nil { return constructGetResponse("scoreboard", scoreBoard, err) } for _, user := range users { flags, err := db.GetPublicFlagsForUser(user.PublicId) if err != nil { return constructGetResponse("scoreboard", scoreBoard, err) } flagInfo := domains.UsersPublicFlagInfo{} flagInfo.PublicUser = user flagInfo.PublicFlags = flags scoreBoard.Scores = append(scoreBoard.Scores, flagInfo) } return constructGetResponse("scoreboard", scoreBoard, nil) }
func getPublicUsers(ctx *web.Context) string { users, err := db.GetPublicUsers() return constructGetResponse("users", users, err) }