controllers

package
v0.9.18 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: AGPL-3.0 Imports: 17 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 {
	GetMediaReviews(c *fiber.Ctx) error
	GetRatings(c *fiber.Ctx) error
	GetLatestRatings(c *fiber.Ctx) error
	GetAverageRating(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

DeleteRating handles the deletion of a user's review for a specific media item

func (*ReviewController) GetAverageRating added in v0.7.0

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

GetAverageRating fetches the average (float64) rating ("stars") score based on a given media UUID, kind and rating type

func (*ReviewController) GetByID added in v0.7.0

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

GetByID retrieves a single review by its ID

func (*ReviewController) GetLatest added in v0.7.0

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

GetLatestRatings retrieves the latest reviews for a specific media item based on the media ID

func (*ReviewController) GetMediaReviews added in v0.7.0

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

GetMediaRatings 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, log *zerolog.Logger, wsAddr string) *SearchController

func (*SearchController) GetWSAddress added in v0.8.18

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

GetWSAddress returns the address of the websocket server, minus the protocol, since that would initialize a new connection

func (*SearchController) Search

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

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

func (*SearchController) WSHandler added in v0.8.18

func (sc *SearchController) WSHandler(c *websocket.Conn)

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