コード例 #1
0
ファイル: liking.go プロジェクト: tka/goyangi
// UpdateLocationLikingCount updates a liking count on article.
func UpdateLocationLikingCount(location *model.Location) (int, error) {
	location.LikingCount = db.ORM.Model(location).Association("Likings").Count()
	if db.ORM.Save(location).Error != nil {
		return http.StatusInternalServerError, errors.New("Location liking's count is not updated.")
	}
	return http.StatusOK, nil
}