review

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: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Review

type Review struct {
	ID         primitive.ObjectID `json:"id" bson:"_id,omitempty"`
	ItemID     primitive.ObjectID `json:"item_id" bson:"item_id"`
	AuthorID   primitive.ObjectID `json:"author_id" bson:"author_id"`
	AuthorName string             `json:"author_name" bson:"author_name"`
	Star       int                `json:"star" bson:"star"`
	Content    string             `json:"content" bson:"content"`
	UpdatedAt  time.Time          `json:"updated_at" bson:"updated_at"`
	Anonymous  bool               `json:"anonymous" bson:"anonymous"`
}

type ReviewController

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

func NewReviewController

func NewReviewController(reviewServices ReviewServices) *ReviewController

func (*ReviewController) GetReview

func (rc *ReviewController) GetReview(c *gin.Context)

func (*ReviewController) GetReviews

func (rc *ReviewController) GetReviews(c *gin.Context)

func (*ReviewController) PostReview

func (rc *ReviewController) PostReview(c *gin.Context)

type ReviewRepo

type ReviewRepo struct {
	Collection *mongo.Collection
}

func NewReviewRepo

func NewReviewRepo(collection *mongo.Collection) *ReviewRepo

func (*ReviewRepo) CreateReview

func (rr *ReviewRepo) CreateReview(review *Review) error

func (*ReviewRepo) GetReview

func (rr *ReviewRepo) GetReview(filter interface{}, opts ...*options.FindOneOptions) (*Review, error)

func (*ReviewRepo) GetReviews

func (rr *ReviewRepo) GetReviews(filter interface{}, opts ...*options.FindOptions) ([]*Review, error)

func (*ReviewRepo) IsExists

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

func (*ReviewRepo) UpdateReview

func (rr *ReviewRepo) UpdateReview(filter interface{}, update interface{}, opts ...*options.UpdateOptions) error

type ReviewRepository

type ReviewRepository interface {
	CreateReview(review *Review) error
	UpdateReview(filter interface{}, update interface{}, opts ...*options.UpdateOptions) error
	GetReview(filter interface{}, opts ...*options.FindOneOptions) (*Review, error)
	GetReviews(filter interface{}, opts ...*options.FindOptions) ([]*Review, error)
	IsExists(filter interface{}, opts ...*options.FindOneOptions) (bool, error)
}

type ReviewServices

type ReviewServices interface {
	PostReview(review *Review) *errors.AppError
	GetReview(reviewId string) (*Review, *errors.AppError)
	GetReviews(itemId string) ([]*Review, *errors.AppError)
}

type ReviewSevice

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

func NewReviewService

func NewReviewService(reviewRepository ReviewRepository, userRepository UserRepository) *ReviewSevice

func (*ReviewSevice) GetReview

func (rs *ReviewSevice) GetReview(reviewId string) (*Review, *errors.AppError)

func (*ReviewSevice) GetReviews

func (rs *ReviewSevice) GetReviews(itemId string) ([]*Review, *errors.AppError)

func (*ReviewSevice) PostReview

func (rs *ReviewSevice) PostReview(review *Review) *errors.AppError

type UserRepository

type UserRepository interface {
	GetUser(filter interface{}) (*user.User, error)
}

Jump to

Keyboard shortcuts

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