distributor

package
v1.0.49 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrate

func Migrate(db *gorm.DB) error

Migrate migrates the database for DistributorService.

It migrates the following database tables:

- distributors

This function does not return an error if the database migration is successful.

Types

type DistributorService

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

func NewDistributorService

func NewDistributorService(db *gorm.DB, ctx *context.ERPContext) *DistributorService

NewDistributorService creates a new DistributorService, which is used to manage distributors. This includes creating, reading, updating, and deleting distributors.

func (*DistributorService) CreateDistributor

func (s *DistributorService) CreateDistributor(data *models.DistributorModel) error

CreateDistributor creates a new distributor based on the given DistributorModel.

This function returns an error if the creation of the distributor fails.

func (*DistributorService) DeleteDistributor

func (s *DistributorService) DeleteDistributor(id string) error

DeleteDistributor deletes the distributor with the given ID.

This function returns an error if the deletion of the distributor fails.

func (*DistributorService) GetAllProduct

func (s *DistributorService) GetAllProduct(request http.Request, search string, distibutorID string, status *string) (paginate.Page, error)

GetAllProduct retrieves a paginated list of products from the inventory service.

It takes an HTTP request, a search query string, a distributor ID, and a product status as parameters. The search query is applied to the product's name and description fields. If the distributor ID is provided, the result is filtered by the distributor ID. If the product status is provided, the result is filtered by the product status. The function utilizes pagination to manage the result set and applies any necessary request modifications using the utils.FixRequest utility.

The function returns a paginated page of ProductModel and an error if the operation fails.

func (*DistributorService) GetDistributorByID

func (s *DistributorService) GetDistributorByID(id string) (*models.DistributorModel, error)

func (*DistributorService) GetDistributors

func (s *DistributorService) GetDistributors(request http.Request, search string) (paginate.Page, error)

GetDistributors retrieves a paginated list of distributors from the database.

It takes an HTTP request and a search query string as input. The search query is applied to the distributor's name and address fields. If the request contains a company ID header, the result is filtered by the company ID. The function utilizes pagination to manage the result set and applies any necessary request modifications using the utils.FixRequest utility.

The function returns a paginated page of DistributorModel and an error if the operation fails.

func (*DistributorService) UpdateDistributor

func (s *DistributorService) UpdateDistributor(id string, data *models.DistributorModel) error

UpdateDistributor updates the distributor with the given ID using the given DistributorModel.

This function returns an error if the update of the distributor fails.

Jump to

Keyboard shortcuts

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