Beispiel #1
0
func clearChat(r render.Render, params martini.Params, re *http.Request, f *fishhub.DBService, chat chat.Chat) {
	chat.Db = f

	chat.Id = bson.ObjectIdHex(params["id"])
	go chat.Clear()
	displaySuccessfulMessage(r, "chat is cleared", "Chat")
}
Beispiel #2
0
func getChats(r render.Render, params martini.Params, re *http.Request, f *fishhub.DBService, chat chat.Chat) {
	chat.Db = f
	chats, err := chat.GetChats()
	if err != nil {
		displayUnknownError(r)
		return
	}

	r.JSON(200, chats)
}
Beispiel #3
0
func newChat(r render.Render, re *http.Request, f *fishhub.DBService, chat chat.Chat, user *user.User) {
	chat.Db = f
	err := chat.Insert()
	if err != nil {
		displayUnknownError(r)
		return
	}

	displaySuccessfulMessage(r, "chat is processed successfully", "Chat")
	return
}
Beispiel #4
0
func clearChats(r render.Render, re *http.Request, f *fishhub.DBService, chat chat.Chat) {
	chat.Db = f
	go chat.ClearAll()
	displaySuccessfulMessage(r, "chats are cleared successfully", "Chat")

}