Merge master

This commit is contained in:
Sinh 2023-03-14 15:02:32 +07:00
commit d03758a32d
3 changed files with 23 additions and 0 deletions

View File

@ -34,6 +34,23 @@ func (c Product) ApplyRequest(p model.ProductApplyRequestPayload) error {
return nil
}
func (c Product) CreateRequestSteps(p model.ProductCreateStepsPayload) error {
msg, err := natsio.GetServer().Request(subject.Product.CreateRequestStep, toBytes(p))
if err != nil {
return err
}
var r struct {
Error string `json:"error"`
}
if err = json.Unmarshal(msg.Data, &r); err != nil {
return err
}
if r.Error != "" {
return errors.New(r.Error)
}
return nil
}
func (c Product) ProcessApplyRequest(p model.ProductApplyRequestPayload) error {
msg, err := natsio.GetServer().Request(subject.Product.ProcessApplyRequest, toBytes(p))
if err != nil {

View File

@ -4,6 +4,10 @@ type ProductApplyRequestPayload struct {
RequestID string `json:"requestId"`
}
type ProductCreateStepsPayload struct {
RequestID string `json:"requestId"`
}
type ProductRequestChangeStatus struct {
RequestID string `json:"requestId"`
Status string `json:"status"`

View File

@ -9,10 +9,12 @@ func getProductValue(val string) string {
var Product = struct {
ApplyRequest string
CreateRequestStep string
ProcessApplyRequest string
RequestChangeStatus string
}{
ApplyRequest: getProductValue("apply_request"),
CreateRequestStep: getProductValue("create_request_step"),
ProcessApplyRequest: getProductValue("process_apply_request"),
RequestChangeStatus: getProductValue("request_change_status"),
}