コード例 #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)
	}
}
コード例 #2
0
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)
}