category

package
v0.0.0-...-56fc341 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Category

type Category struct {
	ID          primitive.ObjectID   `json:"id" bson:"_id,omitempty"`
	Name        string               `json:"name" bson:"name"`
	Slug        string               `json:"slug" bson:"slug"`
	Description string               `json:"description" bson:"description"`
	Images      []string             `json:"images" bson:"images"`
	ParentID    []primitive.ObjectID `json:"parent_id" bson:"parent_id,omitempty"`
	CreatedBy   primitive.ObjectID   `json:"created_by" bson:"created_by,omitempty"`
	UpdatedBy   primitive.ObjectID   `json:"updated_by" bson:"updated_by,omitempty"`
	CreatedAt   time.Time            `json:"created_at" bson:"created_at"`
	UpdatedAt   time.Time            `json:"updated_at" bson:"updated_at"`
}

type CategoryController

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

func NewCategoryController

func NewCategoryController(categoryServices CategoryServices, uploader Uploader) *CategoryController

func (*CategoryController) CreateCategory

func (cc *CategoryController) CreateCategory(c *gin.Context)

func (*CategoryController) DeleteCategory

func (cc *CategoryController) DeleteCategory(c *gin.Context)

func (*CategoryController) GetCategories

func (cc *CategoryController) GetCategories(c *gin.Context)

func (*CategoryController) GetCategoryByID

func (cc *CategoryController) GetCategoryByID(c *gin.Context)

func (*CategoryController) GetCategoryBySlug

func (cc *CategoryController) GetCategoryBySlug(c *gin.Context)

func (*CategoryController) UpdateCategory

func (cc *CategoryController) UpdateCategory(c *gin.Context)

type CategoryRepo

type CategoryRepo struct {
	Collection *mongo.Collection
}

func NewCategoryRepo

func NewCategoryRepo(collection *mongo.Collection) *CategoryRepo

func (*CategoryRepo) CreateCategory

func (cr *CategoryRepo) CreateCategory(category *Category) error

func (*CategoryRepo) DeleteCategory

func (cr *CategoryRepo) DeleteCategory(filter interface{}, opts ...*options.DeleteOptions) error

func (*CategoryRepo) GetCategories

func (cr *CategoryRepo) GetCategories(filter interface{}, opts ...*options.FindOptions) ([]*Category, error)

func (*CategoryRepo) GetCategory

func (cr *CategoryRepo) GetCategory(filter interface{}, opts ...*options.FindOneOptions) (*Category, error)

func (*CategoryRepo) IsExists

func (cr *CategoryRepo) IsExists(filter interface{}, opts ...*options.FindOneOptions) (bool, error)

func (*CategoryRepo) UpdateCategory

func (cr *CategoryRepo) UpdateCategory(filter interface{}, update interface{}, opts ...*options.UpdateOptions) error

type CategoryRepository

type CategoryRepository interface {
	IsExists(filter interface{}, opts ...*options.FindOneOptions) (bool, error)
	CreateCategory(category *Category) error
	UpdateCategory(filter interface{}, update interface{}, opts ...*options.UpdateOptions) error
	GetCategory(filter interface{}, opts ...*options.FindOneOptions) (*Category, error)
	GetCategories(filter interface{}, opts ...*options.FindOptions) ([]*Category, error)
	DeleteCategory(filter interface{}, opts ...*options.DeleteOptions) error
}

type CategoryService

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

func NewCategoryService

func NewCategoryService(categoryRepo CategoryRepository) *CategoryService

func (*CategoryService) CreateCategory

func (cs *CategoryService) CreateCategory(category *Category) *errors.AppError

func (*CategoryService) DeleteCategory

func (cs *CategoryService) DeleteCategory(id string, userid primitive.ObjectID) *errors.AppError

func (*CategoryService) GetCategories

func (cs *CategoryService) GetCategories() ([]*Category, *errors.AppError)

func (*CategoryService) GetCategoryByID

func (cs *CategoryService) GetCategoryByID(id string) (*Category, *errors.AppError)

func (*CategoryService) GetCategoryBySlug

func (cs *CategoryService) GetCategoryBySlug(slug string) (*Category, *errors.AppError)

func (*CategoryService) UpdateCategory

func (cs *CategoryService) UpdateCategory(category *Category) *errors.AppError

type CategoryServices

type CategoryServices interface {
	CreateCategory(category *Category) *errors.AppError
	GetCategoryByID(id string) (*Category, *errors.AppError)
	GetCategories() ([]*Category, *errors.AppError)
	UpdateCategory(category *Category) *errors.AppError
	DeleteCategory(id string, userid primitive.ObjectID) *errors.AppError
	GetCategoryBySlug(slug string) (*Category, *errors.AppError)
}

type Uploader

type Uploader interface {
	UploadImage(ctx context.Context, files []*multipart.FileHeader, collection string) ([]string, *errors.AppError)
}

Jump to

Keyboard shortcuts

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