Skip to content

Commit

Permalink
FIX flow action type typo.
Browse files Browse the repository at this point in the history
  • Loading branch information
karminski committed Nov 29, 2023
1 parent ccd1335 commit 8ee56d0
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 63 deletions.
20 changes: 10 additions & 10 deletions src/request/create_flow_action_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ import (
//
// ```
type CreateFlowActionRequest struct {
ActionType string `json:"actionType" validate:"required"`
DisplayName string `json:"displayName" validate:"required"`
FlowActionType string `json:"flowActionType" validate:"required"`
DisplayName string `json:"displayName" validate:"required"`
ResourceID string `json:"resourceID,omitempty"`
IsVirtualResource bool `json:"isVirtualResource"`
Content map[string]interface{} `json:"content" validate:"required"`
Transformer map[string]interface{} `json:"transformer" validate:"required"`
TriggerMode string `json:"triggerMode" validate:"oneof=manually automate"`
Content map[string]interface{} `json:"content" validate:"required"`
Transformer map[string]interface{} `json:"transformer" validate:"required"`
TriggerMode string `json:"triggerMode" validate:"oneof=manually automate"`
Config map[string]interface{} `json:"config"`
}

Expand All @@ -59,7 +59,7 @@ func (req *CreateFlowActionRequest) ExportTransformerInString() string {
}

func (req *CreateFlowActionRequest) ExportActionTypeInInt() int {
return resourcelist.GetResourceNameMappedID(req.ActionType)
return resourcelist.GetResourceNameMappedID(req.FlowActionType)
}

func (req *CreateFlowActionRequest) ExportResourceIDInInt() int {
Expand All @@ -81,17 +81,17 @@ func (req *CreateFlowActionRequest) AppendVirtualResourceToTemplate(value interf
}

func (req *CreateFlowActionRequest) IsVirtualAction() bool {
return resourcelist.IsVirtualResource(req.ActionType)
return resourcelist.IsVirtualResource(req.FlowActionType)
}

func (req *CreateFlowActionRequest) IsLocalVirtualAction() bool {
return resourcelist.IsLocalVirtualResource(req.ActionType)
return resourcelist.IsLocalVirtualResource(req.FlowActionType)
}

func (req *CreateFlowActionRequest) IsRemoteVirtualAction() bool {
return resourcelist.IsRemoteVirtualResource(req.ActionType)
return resourcelist.IsRemoteVirtualResource(req.FlowActionType)
}

func (req *CreateFlowActionRequest) NeedFetchResourceInfoFromSourceManager() bool {
return resourcelist.NeedFetchResourceInfoFromSourceManager(req.ActionType)
return resourcelist.NeedFetchResourceInfoFromSourceManager(req.FlowActionType)
}
14 changes: 7 additions & 7 deletions src/request/run_flow_action_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,19 @@ const (
)

type RunFlowActionRequest struct {
ResourceID string `json:"resourceID,omitempty"`
ActionType string `json:"actionType" validate:"required"`
DisplayName string `json:"displayName" validate:"required"`
Content map[string]interface{} `json:"content" validate:"required"`
Context map[string]interface{} `json:"context" validate:"required"` // for action content raw param
ResourceID string `json:"resourceID,omitempty"`
FlowActionType string `json:"flowActionType" validate:"required"`
DisplayName string `json:"displayName" validate:"required"`
Content map[string]interface{} `json:"content" validate:"required"`
Context map[string]interface{} `json:"context" validate:"required"` // for action content raw param
}

func NewRunFlowActionRequest() *RunFlowActionRequest {
return &RunFlowActionRequest{}
}

func (req *RunFlowActionRequest) ExportActionTypeInInt() int {
return resourcelist.GetResourceNameMappedID(req.ActionType)
return resourcelist.GetResourceNameMappedID(req.FlowActionType)
}

func (req *RunFlowActionRequest) ExportResourceIDInInt() int {
Expand Down Expand Up @@ -71,5 +71,5 @@ func (req *RunFlowActionRequest) ExportContext() map[string]interface{} {
}

func (req *RunFlowActionRequest) IsVirtualAction() bool {
return resourcelist.IsVirtualResource(req.ActionType)
return resourcelist.IsVirtualResource(req.FlowActionType)
}
12 changes: 6 additions & 6 deletions src/request/update_flow_action_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import (
//
// ```
type UpdateFlowActionRequest struct {
ActionType string `json:"actionType" validate:"required"`
FlowActionType string `json:"flowActionType" validate:"required"`
DisplayName string `json:"displayName" validate:"required"`
ResourceID string `json:"resourceID,omitempty"`
IsVirtualResource bool `json:"isVirtualResource"`
Expand All @@ -70,7 +70,7 @@ func (req *UpdateFlowActionRequest) ExportResourceIDInInt() int {
}

func (req *UpdateFlowActionRequest) ExportActionTypeInInt() int {
return resourcelist.GetResourceNameMappedID(req.ActionType)
return resourcelist.GetResourceNameMappedID(req.FlowActionType)
}

func (req *UpdateFlowActionRequest) ExportTemplateInString() string {
Expand All @@ -88,17 +88,17 @@ func (req *UpdateFlowActionRequest) AppendVirtualResourceToTemplate(value interf
}

func (req *UpdateFlowActionRequest) IsVirtualAction() bool {
return resourcelist.IsVirtualResource(req.ActionType)
return resourcelist.IsVirtualResource(req.FlowActionType)
}

func (req *UpdateFlowActionRequest) IsLocalVirtualAction() bool {
return resourcelist.IsLocalVirtualResource(req.ActionType)
return resourcelist.IsLocalVirtualResource(req.FlowActionType)
}

func (req *UpdateFlowActionRequest) IsRemoteVirtualAction() bool {
return resourcelist.IsRemoteVirtualResource(req.ActionType)
return resourcelist.IsRemoteVirtualResource(req.FlowActionType)
}

func (req *UpdateFlowActionRequest) NeedFetchResourceInfoFromSourceManager() bool {
return resourcelist.NeedFetchResourceInfoFromSourceManager(req.ActionType)
return resourcelist.NeedFetchResourceInfoFromSourceManager(req.FlowActionType)
}
40 changes: 20 additions & 20 deletions src/response/get_flow_action_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type GetFlowActionResponse struct {
Version int `json:"version"`
ResourceID string `json:"resourceID,omitempty"`
DisplayName string `json:"displayName"`
FlowActionType string `json:"actionType"`
FlowActionType string `json:"flowActionType"`
IsVirtualResource bool `json:"isVirtualResource"`
Content map[string]interface{} `json:"content"`
Transformer map[string]interface{} `json:"transformer"`
Expand All @@ -29,26 +29,26 @@ type GetFlowActionResponse struct {
UpdatedBy string `json:"updatedBy,omitempty"`
}

func NewGetFlowActionResponse(action *model.FlowAction) *GetFlowActionResponse {
actionConfig := action.ExportConfig()
func NewGetFlowActionResponse(flowAction *model.FlowAction) *GetFlowActionResponse {
flowActionConfig := flowAction.ExportConfig()
resp := &GetFlowActionResponse{
FlowActionID: idconvertor.ConvertIntToString(action.ID),
UID: action.UID,
TeamID: idconvertor.ConvertIntToString(action.TeamID),
WorkflowID: idconvertor.ConvertIntToString(action.WorkflowID),
Version: action.Version,
ResourceID: idconvertor.ConvertIntToString(action.ResourceID),
DisplayName: action.Name,
FlowActionType: resourcelist.GetResourceIDMappedType(action.Type),
IsVirtualResource: actionConfig.IsVirtualResource,
Content: action.ExportTemplateInMap(),
Transformer: action.ExportTransformerInMap(),
TriggerMode: action.TriggerMode,
Config: action.ExportConfigInMap(),
CreatedAt: action.CreatedAt,
CreatedBy: idconvertor.ConvertIntToString(action.CreatedBy),
UpdatedAt: action.UpdatedAt,
UpdatedBy: idconvertor.ConvertIntToString(action.UpdatedBy),
FlowActionID: idconvertor.ConvertIntToString(flowAction.ID),
UID: flowAction.UID,
TeamID: idconvertor.ConvertIntToString(flowAction.TeamID),
WorkflowID: idconvertor.ConvertIntToString(flowAction.WorkflowID),
Version: flowAction.Version,
ResourceID: idconvertor.ConvertIntToString(flowAction.ResourceID),
DisplayName: flowAction.Name,
FlowActionType: resourcelist.GetResourceIDMappedType(flowAction.Type),
IsVirtualResource: flowActionConfig.IsVirtualResource,
Content: flowAction.ExportTemplateInMap(),
Transformer: flowAction.ExportTransformerInMap(),
TriggerMode: flowAction.TriggerMode,
Config: flowAction.ExportConfigInMap(),
CreatedAt: flowAction.CreatedAt,
CreatedBy: idconvertor.ConvertIntToString(flowAction.CreatedBy),
UpdatedAt: flowAction.UpdatedAt,
UpdatedBy: idconvertor.ConvertIntToString(flowAction.UpdatedBy),
}
return resp
}
Expand Down
40 changes: 20 additions & 20 deletions src/response/update_flow_action_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type UpdateFlowActionResponse struct {
Version int `json:"version"`
ResourceID string `json:"resourceID,omitempty"`
DisplayName string `json:"displayName"`
FlowActionType string `json:"actionType"`
FlowActionType string `json:"flowActionType"`
IsVirtualResource bool `json:"isVirtualResource"`
Content map[string]interface{} `json:"content"`
Transformer map[string]interface{} `json:"transformer"`
Expand All @@ -29,26 +29,26 @@ type UpdateFlowActionResponse struct {
UpdatedBy string `json:"updatedBy,omitempty"`
}

func NewUpdateFlowActionResponse(action *model.FlowAction) *UpdateFlowActionResponse {
actionConfig := action.ExportConfig()
func NewUpdateFlowActionResponse(flowAction *model.FlowAction) *UpdateFlowActionResponse {
flowActionConfig := flowAction.ExportConfig()
resp := &UpdateFlowActionResponse{
FlowActionID: idconvertor.ConvertIntToString(action.ID),
UID: action.UID,
TeamID: idconvertor.ConvertIntToString(action.TeamID),
WorkflowID: idconvertor.ConvertIntToString(action.WorkflowID),
Version: action.Version,
ResourceID: idconvertor.ConvertIntToString(action.ResourceID),
DisplayName: action.Name,
FlowActionType: resourcelist.GetResourceIDMappedType(action.Type),
IsVirtualResource: actionConfig.IsVirtualResource,
Content: action.ExportTemplateInMap(),
Transformer: action.ExportTransformerInMap(),
TriggerMode: action.TriggerMode,
Config: action.ExportConfigInMap(),
CreatedAt: action.CreatedAt,
CreatedBy: idconvertor.ConvertIntToString(action.CreatedBy),
UpdatedAt: action.UpdatedAt,
UpdatedBy: idconvertor.ConvertIntToString(action.UpdatedBy),
FlowActionID: idconvertor.ConvertIntToString(flowAction.ID),
UID: flowAction.UID,
TeamID: idconvertor.ConvertIntToString(flowAction.TeamID),
WorkflowID: idconvertor.ConvertIntToString(flowAction.WorkflowID),
Version: flowAction.Version,
ResourceID: idconvertor.ConvertIntToString(flowAction.ResourceID),
DisplayName: flowAction.Name,
FlowActionType: resourcelist.GetResourceIDMappedType(flowAction.Type),
IsVirtualResource: flowActionConfig.IsVirtualResource,
Content: flowAction.ExportTemplateInMap(),
Transformer: flowAction.ExportTransformerInMap(),
TriggerMode: flowAction.TriggerMode,
Config: flowAction.ExportConfigInMap(),
CreatedAt: flowAction.CreatedAt,
CreatedBy: idconvertor.ConvertIntToString(flowAction.CreatedBy),
UpdatedAt: flowAction.UpdatedAt,
UpdatedBy: idconvertor.ConvertIntToString(flowAction.UpdatedBy),
}
return resp
}
Expand Down

0 comments on commit 8ee56d0

Please sign in to comment.