示例#1
0
func initRoutes() {
	user := user.User{}
	user.InitUser()

	session := session.Session{}
	session.InitSession()

	place := place.Place{}
	place.InitPlace()

	post := post.Post{}
	post.InitPost()

	like := like.Like{}
	like.InitLike()

	talk := talk.Talk{}
	talk.InitTalk()

	match := match.Match{}
	match.InitMatch()

	notification := notification.Notification{}
	notification.InitNotification()

	message := message.Message{}
	message.InitMessage()

	fs := http.FileServer(http.Dir("./assets"))
	http.Handle("/Images/", fs)
}
示例#2
0
func (like *Like) getLikesByUserId(searchWithPost bool, limit int, offset int) interface{} {
	var list []Like
	var likelist LikeList

	curs, err := r.Table("likes").
		Filter(r.Row.Field("UserId").Eq(like.user.Id)).
		Slice(offset, offset+limit).
		Run(api.Sess)

	if err != nil && searchWithPost == true {
		return LikeAndPostList{}
	}
	if err != nil && searchWithPost == false {
		return likelist
	}

	curs.All(&list)
	defer curs.Close()

	if searchWithPost == true {
		likeAndPostList := LikeAndPostList{}
		var liste []LikeAndPost
		for _, aLike := range list {
			post := post.Post{Id: aLike.PostId}
			post.GetPostById()
			likeAndPost := LikeAndPost{Like: aLike, Post: post}
			liste = append(liste, likeAndPost)
		}
		likeAndPostList.List = liste
		return likeAndPostList
	}
	likelist.List = list
	return likelist
}