func RoomsIndex(c *gin.Context) { user, err := GetUserFromContext(c) if err != nil { c.Fail(500, err) } rooms, err := models.FindRooms(user.TeamId) if err != nil { c.Fail(500, err) } memberships, err := models.FindRoomMemberships(user.Id) if err != nil { c.Fail(500, err) } unread, err := models.UnreadRooms(user.Id) if err != nil { c.Fail(500, err) } c.JSON(200, gin.H{ "rooms": rooms, "memberships": memberships, "unread_rooms": unread, }) }
func RoomsUnread(c *gin.Context) { user, err := GetUserFromContext(c) if err != nil { c.Fail(500, err) } unread, err := models.UnreadRooms(user.Id) if err != nil { c.Fail(500, err) } c.JSON(200, gin.H{"unread": unread}) }