watchlist

package
v0.0.0-...-6ecc318 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrWatchlistNotFound = errors.New("error watchlist not found")
	ErrPermissionDeny    = errors.New("error permission deny")
	ErrMovieNotFound     = errors.New("error movie not found")
	ErrDB                = errors.New("error DB")
)

Functions

This section is empty.

Types

type Handler

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

func NewHandler

func NewHandler(srv service) *Handler

func (*Handler) AddMovieToWatchlist

func (h *Handler) AddMovieToWatchlist(w http.ResponseWriter, r *http.Request)

func (*Handler) CreateWatchlist

func (h *Handler) CreateWatchlist(w http.ResponseWriter, r *http.Request)

func (*Handler) DeleteMovieInWatchlist

func (h *Handler) DeleteMovieInWatchlist(w http.ResponseWriter, r *http.Request)

func (*Handler) DeleteWatchlist

func (h *Handler) DeleteWatchlist(w http.ResponseWriter, r *http.Request)

func (*Handler) GetAllMoviesInWatchlist

func (h *Handler) GetAllMoviesInWatchlist(w http.ResponseWriter, r *http.Request)

func (*Handler) GetAllWatchlistByUserId

func (h *Handler) GetAllWatchlistByUserId(w http.ResponseWriter, r *http.Request)

func (*Handler) GetWatchlistById

func (h *Handler) GetWatchlistById(w http.ResponseWriter, r *http.Request)

func (*Handler) Routes

func (h *Handler) Routes() []router.Route

func (*Handler) UpdateStatusWatchList

func (h *Handler) UpdateStatusWatchList(w http.ResponseWriter, r *http.Request)

type MongoDBRepository

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

func NewRepository

func NewRepository(session *mgo.Session) *MongoDBRepository

func (*MongoDBRepository) AddMovieToWatchlist

func (r *MongoDBRepository) AddMovieToWatchlist(movieID, watchlistID string) error

func (*MongoDBRepository) CreateWatchlist

func (r *MongoDBRepository) CreateWatchlist(ctx context.Context, usrID, name string) (string, error)

func (*MongoDBRepository) DeleteMovieInWatchlist

func (r *MongoDBRepository) DeleteMovieInWatchlist(movieID, watchlistID string) error

func (*MongoDBRepository) DeleteWatchlist

func (r *MongoDBRepository) DeleteWatchlist(watchlistID string) error

func (*MongoDBRepository) GetAllWatchlistByUserId

func (r *MongoDBRepository) GetAllWatchlistByUserId(id string) ([]*Watchlist, error)

func (*MongoDBRepository) GetWatchlistById

func (r *MongoDBRepository) GetWatchlistById(id string) (*Watchlist, error)

func (*MongoDBRepository) ListAllMovies

func (r *MongoDBRepository) ListAllMovies(id string) ([]*WatchlistMovie, error)

func (*MongoDBRepository) UpdateStatusWatchList

func (r *MongoDBRepository) UpdateStatusWatchList(ctx context.Context, watchlistID string, status bool) error

type Service

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

func NewService

func NewService(repository repository) *Service

func (*Service) AddMovieToWatchlist

func (s *Service) AddMovieToWatchlist(ctx context.Context, movieID, watchlistID string) error

func (*Service) CreateWatchlist

func (s *Service) CreateWatchlist(ctx context.Context, name string) (string, error)

func (*Service) DeleteMovieInWatchlist

func (s *Service) DeleteMovieInWatchlist(ctx context.Context, movieID, watchlistID string) error

func (*Service) DeleteWatchlist

func (s *Service) DeleteWatchlist(ctx context.Context, watchlistID string) error

func (*Service) GetAllWatchlistByUserId

func (s *Service) GetAllWatchlistByUserId(ctx context.Context, userID string) ([]*WatchlistResponse, error)

func (*Service) GetWatchlistById

func (s *Service) GetWatchlistById(ctx context.Context, id string) (*WatchlistResponse, error)

func (*Service) ListAllMovies

func (s *Service) ListAllMovies(ctx context.Context, id string) ([]string, error)

func (*Service) UpdateStatusWatchList

func (s *Service) UpdateStatusWatchList(ctx context.Context, watchlistID string, status bool) (string, error)

type Watchlist

type Watchlist struct {
	ID        string    `bson:"_id"`
	UserID    string    `bson:"user_id"`
	Name      string    `bson:"name"`
	Share     bool      `bson:"share"`
	CreatedAt time.Time `bson:"created_at"`
	UpdatedAt time.Time `bson:"updated_at"`
}

func (*Watchlist) ConvertToWatchlistResponse

func (w *Watchlist) ConvertToWatchlistResponse() *WatchlistResponse

type WatchlistMovie

type WatchlistMovie struct {
	ID          string `bson:"_id"`
	WatchlistID string `bson:"watchlist_id"`
	MovieID     string `bson:"movie_id"`
}

type WatchlistResponse

type WatchlistResponse struct {
	ID        string    `json:"_id"`
	UserID    string    `json:"user_id"`
	Name      string    `json:"name"`
	Share     bool      `json:"share"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

Jump to

Keyboard shortcuts

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