library

package
v0.0.0-...-5d17f3a Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

library/routes.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BookHandler

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

func NewBookHandler

func NewBookHandler(bookStore types.BookStore, userStore types.UserStore) *BookHandler

func (*BookHandler) RegisterRoutes

func (h *BookHandler) RegisterRoutes(router *mux.Router)

type BookStore

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

func NewBookStore

func NewBookStore(db *sql.DB) (*BookStore, error)

func (*BookStore) AddToFavorites

func (s *BookStore) AddToFavorites(userID, bookID string) error

Add a book to user's favorites list

func (*BookStore) CreateBook

func (s *BookStore) CreateBook(book types.CreateBookPayload) error

func (*BookStore) DeleteBook

func (s *BookStore) DeleteBook(bookID string) error

func (*BookStore) DeleteReview

func (s *BookStore) DeleteReview(reviewID string) error

Admin deletes a review

func (*BookStore) DeleteUserReview

func (s *BookStore) DeleteUserReview(userID, reviewID string) error

Delete a user review

func (*BookStore) GetAllBooks

func (s *BookStore) GetAllBooks() ([]*types.Book, error)

func (*BookStore) GetBookByID

func (s *BookStore) GetBookByID(bookID string) (*types.Book, error)

func (*BookStore) GetReviews

func (s *BookStore) GetReviews(bookID string) ([]types.Review, error)

Get reviews for a book

func (*BookStore) PostReview

func (s *BookStore) PostReview(userID, bookID string, review types.ReviewPayload) error

Post a review for a book

func (*BookStore) SearchBooks

func (s *BookStore) SearchBooks(searchTerm string) ([]types.Book, error)

func (*BookStore) UpdateBook

func (s *BookStore) UpdateBook(bookID string, book types.UpdateBookPayload) error

Jump to

Keyboard shortcuts

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