示例#1
0
func addLeagueGameLinks(league *domain.League, c *gin.Context) {
	gamesURL := fmt.Sprintf("/api/leagues/%d/games", league.ID)
	league.AddLink(relGames, gamesURL)

	if isAuthenticated(c) {
		league.AddLink(relCreateGame, gamesURL)
	}
}
func addLeagueLinks(league *domain.League, c *gin.Context) {
	selfURL := fmt.Sprintf("/api/leagues/%d", league.ID)

	league.AddLink(domain.RelSelf, selfURL)

	if isAuthenticated(c) {
		league.AddLink(domain.RelUpdate, selfURL)
	}

	addLeagueGameLinks(league, c)
}