Documentation ¶
Index ¶
- func CheckUser() gin.HandlerFunc
- func Count() int
- func CountBookmarks() int
- func CountCategories() int
- func CountComments() int
- func CountFaculties() int
- func CountReviews() int
- func Delete(key string) error
- func DeleteBookmark(bookmark *Bookmark) error
- func DeleteComment(id string) error
- func DeleteReview(key string) error
- func FindCountReviews(query *ReviewQuery) int
- func FlushCaches()
- func GetCategories() ([]string, error)
- func GetCategoriesAtIndex(index int) ([]string, error)
- func GetCurrentSemester() (curr string, err error)
- func GetFaculties() ([]string, error)
- func GetMaxCommentIndexByEvent(eventID string) (count uint8, err error)
- func GetReviewAverages(eventID string) (map[string]float32, error)
- func GetTypes() ([]string, error)
- func Init(store *bolthold.Store, eventBus *hub.Hub)
- func Insert(event *Event, upsert bool, overwrite bool) error
- func InsertBookmark(bookmark *Bookmark) error
- func InsertComment(comment *Comment, upsert bool) error
- func InsertMulti(events []*Event, upsert bool, overwrite bool) error
- func InsertReview(review *Review, upsert bool) error
- func MustGetCurrentSemester() string
- func RegisterAPIRoutes(router *gin.Engine, group *gin.RouterGroup)
- func RegisterRoutes(router *gin.Engine, group *gin.RouterGroup)
- func Reindex()
- type Bookmark
- type Comment
- type CommentQuery
- type Event
- type EventDate
- type EventQuery
- type EventSearchResultItem
- type Lecturer
- type Link
- type Review
- type ReviewQuery
- type Semesters
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckUser ¶
func CheckUser() gin.HandlerFunc
CheckUser checks whether a user is attached to the current context
func DeleteBookmark ¶
DeleteBookmark removes a user by its Id
func FindCountReviews ¶
func FindCountReviews(query *ReviewQuery) int
FindCountReviews returns the amount of reviews matching the given query
func GetCategoriesAtIndex ¶
GetCategoriesAtIndex ?
func GetCurrentSemester ¶
GetCurrentSemester returns the current semester
func GetMaxCommentIndexByEvent ¶
GetMaxCommentIndexByEvent returns the index of the last inserted comment for the given event
func GetReviewAverages ¶
GetReviewAverages aggregates the average ratings of all reviews of a given event
func InsertBookmark ¶
InsertBookmark adds a new bookmark or updates an existing one
func InsertComment ¶
InsertComment adds a new comment or updates an existing one
func InsertMulti ¶
InsertMulti adds a new events or updates an existing ones
func InsertReview ¶
InsertReview adds a new review or updates an existing one
func MustGetCurrentSemester ¶
func MustGetCurrentSemester() string
MustGetCurrentSemester returns the current semester
func RegisterAPIRoutes ¶
func RegisterAPIRoutes(router *gin.Engine, group *gin.RouterGroup)
RegisterAPIRoutes registers all API routes with the given router instance
func RegisterRoutes ¶
func RegisterRoutes(router *gin.Engine, group *gin.RouterGroup)
RegisterRoutes registers all public routes with the given router instance
Types ¶
type Bookmark ¶
type Bookmark struct { Id uint64 `boltholdKey:"Id"` UserId string `boltholdIndex:"UserId"` EntityId string `boltholdIndex:"EntityId"` }
Bookmark represents a bookmarked event
func FindBookmark ¶
FindBookmark retrieves the bookmarks for the given user and event
func FindBookmarks ¶
FindBookmarks retrieves a list of bookmarks for the given user
func GetAllBookmarks ¶
GetAllBookmarks retrieves all bookmarks
func GetBookmark ¶
GetBookmark retrieves a bookmark by its Id
type Comment ¶
type Comment struct { Id string `form:"" boltholdIndex:"Id"` Index uint8 `form:"" boltholdIndex:"Index"` EventId string `form:"event_id" boltholdIndex:"EventId"` UserId string `form:"" boltholdIndex:"UserId"` Active bool `form:"" boltholdIndex:"Active"` Text string `form:"text" binding:"required"` CreatedAt time.Time `form:""` }
Comment represents a comment for an event
func FindComments ¶
func FindComments(query *CommentQuery) ([]*Comment, error)
FindComments retrieves a list of comments matching the given query
func GetAllComments ¶
GetAllComments retrieves all available comments
func GetComment ¶
GetComment retrieves a comment by its Id
type CommentQuery ¶
CommentQuery is used to query for comments
type Event ¶
type Event struct { Id string `boltholdIndex:"Id"` Gguid string Name string `boltholdIndex:"Name"` Type string `boltholdIndex:"Type"` Description string Faculty string Institute string `boltholdIndex:"Institute"` Rating float32 // for caching purposes only; actual rating is kept as reviews.Reviews InverseRating float32 `boltholdIndex:"InverseRating"` Categories []string `boltholdSliceIndex:"Categories"` Links []*Link Dates []*EventDate Lecturers []*Lecturer Semesters []string `boltholdSliceIndex:"Semesters"` }
Event represents an events (lecture, tutorial, etc.) in this application
func Find ¶
func Find(query *EventQuery) ([]*Event, error)
Find retrieves a list of events matching the given query
func (*Event) GetFaculty ¶
type EventQuery ¶
type EventQuery struct { NameLike string TypeEq string LecturerIdEq string SemesterEq string CategoryIn []string Skip int Limit int SortFields []string }
EventQuery is used to query saved events
type EventSearchResultItem ¶
type EventSearchResultItem struct { Id string `json:"id"` Name string `json:"name"` Type string `json:"type"` Lecturers []string `json:"lecturers"` }
EventSearchResultItem represents an item in the result list of an event query
func NewEventSearchResultItem ¶
func NewEventSearchResultItem(event *Event) *EventSearchResultItem
NewEventSearchResultItem instantiates a new EventSearchResultItem
type Review ¶
type Review struct { Id string `json:"" boltholdIndex:"Id"` EventId string `json:"event_id" boltholdIndex:"EventId"` UserId string `json:"" boltholdIndex:"UserId"` Ratings map[string]uint8 `json:"ratings"` CreatedAt time.Time `json:"" boltholdIndex:"CreatedAt"` }
Review represents an event review
TODO: View models!
func FindReviews ¶
func FindReviews(query *ReviewQuery) ([]*Review, error)
FindReviews retrieves a list of reviews matching the given query
type ReviewQuery ¶
ReviewQuery is used to query for reviews