controllers

package
v0.6.0-RC-3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2023 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRecommendations

func GetRecommendations(c *fiber.Ctx) error

GetRecommendations returns media recommendations for a user based on collaborative filtering TODO: the actual underlying functionality, i.e. the recommendations server

Types

type IReviewController

type IReviewController interface {
	GetRatings(c *fiber.Ctx) error
	GetLatestRatings(c *fiber.Ctx) error
	GetAverageRatings(c *fiber.Ctx) error
	PostRating(c *fiber.Ctx) error
}

IReviewController is the interface for the review controller It defines the methods that the review controller must implement This is useful for mocking the review controller in unit tests

type ISearchController

type ISearchController interface {
	Search(c *fiber.Ctx) error
}

ISearchController is the interface for the search controller. It is mostly useful for automatically generating mocks for unit tests.

type ReviewController

type ReviewController struct {
	// contains filtered or unexported fields
}

ReviewController is the controller for review endpoints

func NewReviewController

func NewReviewController(rs models.RatingStorage) *ReviewController

func (*ReviewController) DeleteRating

func (rc *ReviewController) DeleteRating(c *fiber.Ctx) error

func (*ReviewController) GetAverageRatings

func (rc *ReviewController) GetAverageRatings(c *fiber.Ctx) error

GetAverageRatings retrieves the average number of stars for the general models.Rating type (i.e. not track or cast ratings)

func (*ReviewController) GetLatestRatings

func (rc *ReviewController) GetLatestRatings(ctx *fiber.Ctx) error

func (*ReviewController) GetRatings

func (rc *ReviewController) GetRatings(c *fiber.Ctx) error

GetRatings retrieves reviews for a specific media item based on the media ID

func (*ReviewController) PostRating

func (rc *ReviewController) PostRating(c *fiber.Ctx) error

PostRating handles the submission of a user's review for a specific media item

func (*ReviewController) UpdateRating

func (rc *ReviewController) UpdateRating(c *fiber.Ctx) error

UpdateRating handles the update of a user's review for a specific media item The types of values that can be updated are defined by the union type models.UpdateableKeyTypes This way, things like the date of the review are not updateable

type SearchController

type SearchController struct {
	// contains filtered or unexported fields
}

SearchController is the controller for search endpoints It provides a bridge between the HTTP layer and the database layer

func NewSearchController

func NewSearchController(dbConn *sqlx.DB) *SearchController

func (*SearchController) Search

func (sc *SearchController) Search(c *fiber.Ctx) error

Search calls the private function performSearch to perform a full text search

type SearchResult

type SearchResult struct {
	Type string `json:"type" db:"type"`
	ID   string `json:"id" db:"id"`
	Name string `json:"name" db:"name"`
}

Search result holds the fields into which the results of a full text search are marshalled

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL