示例#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")
}
示例#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)
}
示例#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
}
示例#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")

}