ui/offering.go
func (h *Handler) ChangeOfferingStatus(
	tkn, offering, action string, gasPrice uint64) error {
	logger := h.logger.Add("method", "ChangeOfferingStatus",
		"offering", offering, "action", action, "gasPrice", gasPrice)

	if !h.token.Check(tkn) {
		logger.Warn("access denied")
		return ErrAccessDenied
	}

	jobType, ok := OfferingChangeActions[action]
	if !ok {
		logger.Warn(ErrBadOfferingStatusAction.Error())
		return ErrBadOfferingStatusAction
	}

	offer := &data.Offering{}
	err := h.findByPrimaryKey(logger, ErrOfferingNotFound, offer, offering)
	if err != nil {
		return err
	}

	jobData := &data.JobPublishData{GasPrice: gasPrice}
	if err := job.AddWithData(h.queue, nil, jobType, data.JobOffering,
		offering, data.JobUser, jobData); err != nil {
		logger.Error(err.Error())
		return ErrInternal
	}

	return nil
}
func (h *Handler) ChangeOfferingStatus(
	tkn, offering, action string, gasPrice uint64) error {
	logger := h.logger.Add("method", "ChangeOfferingStatus",
		"offering", offering, "action", action, "gasPrice", gasPrice)

	if !h.token.Check(tkn) {
		logger.Warn("access denied")
		return ErrAccessDenied
	}

	jobType, ok := OfferingChangeActions[action]
	if !ok {
		logger.Warn(ErrBadOfferingStatusAction.Error())
		return ErrBadOfferingStatusAction
	}

	offer := &data.Offering{}
	err := h.findByPrimaryKey(logger, ErrOfferingNotFound, offer, offering)
	if err != nil {
		return err
	}

	jobData := &data.JobPublishData{GasPrice: gasPrice}
	if err := job.AddWithData(h.queue, nil, jobType, data.JobOffering,
		offering, data.JobUser, jobData); err != nil {
		logger.Error(err.Error())
		return ErrInternal
	}

	return nil
}
func ( h * Handler ) ChangeOfferingStatus ( tkn , offering , action string , gasPrice uint64 ) error { logger := h . logger . Add ( " " , " " , " " , offering , " " , action , " " , gasPrice ) if ! h . token . Check ( tkn ) { logger . Warn ( " " ) return ErrAccessDenied } jobType , ok := OfferingChangeActions [ action ] if ! ok { logger . Warn ( ErrBadOfferingStatusAction . Error ( ) ) return ErrBadOfferingStatusAction } offer := & data . Offering { } err := h . findByPrimaryKey ( logger , ErrOfferingNotFound , offer , offering ) if err != nil { return err } jobData := & data . JobPublishData { GasPrice : gasPrice } if err := job . AddWithData ( h . queue , nil , jobType , data . JobOffering , offering , data . JobUser , jobData ) ; err != nil { logger . Error ( err . Error ( ) ) return ErrInternal } return nil }
// ChangeOfferingStatus initiates JobAgentPreOfferingMsgBCPublish,
// JobAgentPreOfferingPopUp or JobAgentPreOfferingDelete job,
// depending on a selected action.
ChangeOfferingStatus initiates JobAgentPreOfferingMsgBCPublish JobAgentPreOfferingPopUp or JobAgentPreOfferingDelete job depending on a selected action .