Documentation
¶
Index ¶
- Variables
- type CreateRequest
- type FindRequest
- type Handler
- func (h *Handler) CreateMovie(w http.ResponseWriter, r *http.Request)
- func (h *Handler) DeleteMovieById(w http.ResponseWriter, r *http.Request)
- func (h *Handler) GetAllMovies(w http.ResponseWriter, r *http.Request)
- func (h *Handler) GetMovieById(w http.ResponseWriter, r *http.Request)
- func (h *Handler) Routes() []router.Route
- func (h *Handler) Update(w http.ResponseWriter, r *http.Request)
- type MongoDBRepository
- func (m *MongoDBRepository) Create(ctx context.Context, movie Movie) (string, error)
- func (m *MongoDBRepository) DeleteById(ctx context.Context, id string) error
- func (m *MongoDBRepository) GetAllMovies(ctx context.Context, req FindRequest) ([]*Movie, error)
- func (m *MongoDBRepository) GetMovieById(ctx context.Context, id string) (*Movie, error)
- func (m *MongoDBRepository) GetMovieByName(ctx context.Context, name string) (*Movie, error)
- func (m *MongoDBRepository) Update(ctx context.Context, movie *Movie) error
- type Movie
- type Service
- func (s *Service) Create(ctx context.Context, req CreateRequest) (string, error)
- func (s *Service) CreateMovie(m types.MovieInfo) error
- func (s *Service) DeleteById(ctx context.Context, id string) error
- func (s *Service) GetAllMovies(ctx context.Context, req FindRequest) ([]*types.MovieInfo, error)
- func (s *Service) GetMovieById(ctx context.Context, id string) (*types.MovieInfo, error)
- func (s *Service) GetMovieByName(name string) (*types.MovieInfo, error)
- func (s *Service) Update(ctx context.Context, id string, req UpdateRequest) error
- type UpdateRequest
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type CreateRequest ¶
type CreateRequest struct { Name string `validate:"required" json:"name"` Rate float64 `validate:"required" json:"rate"` Directors []string `validate:"required" json:"directors"` Writers []string `validate:"required" json:"writers"` Casts []string `validate:"required" json:"casts"` Genres []string `validate:"required" json:"genres"` MovieLength int `validate:"required" json:"movie_length"` ReleaseTime string `validate:"required" json:"release_time"` }
type FindRequest ¶
type FindRequest struct { Name string `json:"name"` Rate float64 `json:"rate"` Directors []string `json:"directors"` Writers []string `json:"writers"` Genres []string `json:"genres"` Casts []string `json:"casts"` MovieLength int `json:"movie_length"` ReleaseTime string `json:"release_time"` CreatedByID string `json:"created_by_id"` Offset int `json:"offset"` Limit int `json:"limit"` Selects []string `json:"selects"` SortBy []string `json:"sort_by"` }
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func NewHandler ¶
func NewHandler(srv service) *Handler
func (*Handler) CreateMovie ¶
func (h *Handler) CreateMovie(w http.ResponseWriter, r *http.Request)
func (*Handler) DeleteMovieById ¶
func (h *Handler) DeleteMovieById(w http.ResponseWriter, r *http.Request)
func (*Handler) GetAllMovies ¶
func (h *Handler) GetAllMovies(w http.ResponseWriter, r *http.Request)
func (*Handler) GetMovieById ¶
func (h *Handler) GetMovieById(w http.ResponseWriter, r *http.Request)
type MongoDBRepository ¶
type MongoDBRepository struct {
// contains filtered or unexported fields
}
func NewMongoDBRepository ¶
func NewMongoDBRepository(s *mgo.Session) *MongoDBRepository
func (*MongoDBRepository) DeleteById ¶
func (m *MongoDBRepository) DeleteById(ctx context.Context, id string) error
func (*MongoDBRepository) GetAllMovies ¶
func (m *MongoDBRepository) GetAllMovies(ctx context.Context, req FindRequest) ([]*Movie, error)
func (*MongoDBRepository) GetMovieById ¶
func (*MongoDBRepository) GetMovieByName ¶
type Movie ¶
type Movie struct { ID string `bson:"_id"` Name string `bson:"name"` Rate float64 `bson:"rate"` Directors []string `bson:"directors"` Writers []string `bson:"writers"` TrailersPath []string `bson:"trailers_path"` ImagesPath []string `bson:"images_path"` Casts []string `bson:"casts"` Genres []string `bson:"genres"` Storyline string `bson:"storyline"` UserReviews []string `bson:"user_reviews"` MovieLength int `bson:"movie_length"` ReleaseTime string `bson:"release_time"` CreatedAt *time.Time `bson:"created_at"` UpdatedAt *time.Time `bson:"updated_at"` UserId string `bson:"user_id"` }
func (*Movie) ConvertMovieToMovieResponse ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(repo repository) *Service
func (*Service) CreateMovie ¶
CreateMovie for crawler use
func (*Service) GetAllMovies ¶
func (*Service) GetMovieById ¶
func (*Service) GetMovieByName ¶
type UpdateRequest ¶
type UpdateRequest struct { Name string `json:"name"` Rate float64 `json:"rate"` Directors []string `json:"directors"` Writers []string `json:"writers"` TrailersPath []string `json:"trailers_path"` ImagesPath []string `json:"images_path"` Genres []string `json:"genres"` Casts []string `json:"casts"` Storyline string `json:"storyline"` UserReviews []string `json:"user_reviews"` MovieLength int `json:"movie_length"` ReleaseTime string `json:"release_time"` }
Click to show internal directories.
Click to hide internal directories.