services

package
v1.0.14 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VideoCollection      = "videos"
	CategoriesCollection = "categories"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CategoryService

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

func ProvideCategoryService

func ProvideCategoryService(database DatabaseService) CategoryService

func (*CategoryService) Create

func (cs *CategoryService) Create(insertCategory dto.InsertCategory) (*models.Category, error)

func (*CategoryService) Delete

func (cs *CategoryService) Delete(id primitive.ObjectID) error

func (*CategoryService) GetAll

func (cs *CategoryService) GetAll(filter string, page int64, pageSize int64) ([]models.Category, error)

func (*CategoryService) GetById

func (cs *CategoryService) GetById(id primitive.ObjectID) (*models.Category, error)

func (*CategoryService) GetFreeCategory

func (cs *CategoryService) GetFreeCategory() *models.Category

func (*CategoryService) GetVideosByCategoryId

func (cs *CategoryService) GetVideosByCategoryId(id primitive.ObjectID) ([]models.Video, error)

func (*CategoryService) Update

type DatabaseService

type DatabaseService struct {
	*mongo.Database
}

func ProvideDatabaseService

func ProvideDatabaseService() DatabaseService

type VideoService

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

func ProvideVideoService

func ProvideVideoService(cs CategoryService, service DatabaseService) VideoService

func (*VideoService) Create

func (vs *VideoService) Create(model dto.InsertVideo) (*models.Video, error)

func (*VideoService) Delete

func (vs *VideoService) Delete(id primitive.ObjectID) error

func (*VideoService) GetAll

func (vs *VideoService) GetAll(filter string, page int64, pageSize int64) ([]models.Video, error)

func (*VideoService) GetAllFreeVideos

func (vs *VideoService) GetAllFreeVideos() ([]models.Video, error)

func (*VideoService) GetByID

func (vs *VideoService) GetByID(id primitive.ObjectID) (*models.Video, error)

func (*VideoService) Update

func (vs *VideoService) Update(id primitive.ObjectID, newData dto.InsertVideo) (*models.Video, error)

Jump to

Keyboard shortcuts

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