Skip to content

Commit

Permalink
Naming consistency
Browse files Browse the repository at this point in the history
rename UploadAttachment => UploadAttachments
  • Loading branch information
benpate committed Apr 4, 2024
1 parent aab6e18 commit c65ad19
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions builder/step_.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ func ExecutableStep(stepInfo step.Step) Step {
case step.UnPublish:
return StepUnPublish(s)

case step.UploadAttachment:
return StepUploadAttachment(s)
case step.UploadAttachments:
return StepUploadAttachments(s)

case step.ViewFeed:
return StepViewFeed(s)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"github.com/rs/zerolog/log"
)

// StepUploadAttachment represents an action that can upload attachments. It can only be used on a StreamBuilder
type StepUploadAttachment struct {
// StepUploadAttachments represents an action that can upload attachments. It can only be used on a StreamBuilder
type StepUploadAttachments struct {
Action string // Action to perform when uploading the attachment ("append" or "replace")
Fieldname string // Name of the form field that contains the file data (Default: "file")
AttachmentPath string // Path name to store the AttachmentID
Expand All @@ -23,13 +23,13 @@ type StepUploadAttachment struct {
JSONResult bool // If TRUE, return a JSON structure with result data. This forces Maximum=1
}

func (step StepUploadAttachment) Get(builder Builder, _ io.Writer) PipelineBehavior {
func (step StepUploadAttachments) Get(builder Builder, _ io.Writer) PipelineBehavior {
return nil
}

func (step StepUploadAttachment) Post(builder Builder, buffer io.Writer) PipelineBehavior {
func (step StepUploadAttachments) Post(builder Builder, buffer io.Writer) PipelineBehavior {

const location = "handler.StepUploadAttachment.Post"
const location = "handler.StepUploadAttachments.Post"

log.Debug().Msg(location)

Expand Down
2 changes: 1 addition & 1 deletion model/step/step.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func New(stepInfo mapof.Any) (Step, error) {
return NewUnPublish(stepInfo)

case "upload-attachments":
return NewUploadAttachment(stepInfo)
return NewUploadAttachments(stepInfo)

case "view-feed":
return NewViewFeed(stepInfo)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"github.com/benpate/rosetta/mapof"
)

// UploadAttachment represents an action that can upload attachments. It can only be used on a StreamBuilder
type UploadAttachment struct {
// UploadAttachments represents an action that can upload attachments. It can only be used on a StreamBuilder
type UploadAttachments struct {
Action string // Action to perform when uploading the attachment ("append" or "replace")
Fieldname string // Name of the form field that contains the file data (Default: "file")
AttachmentPath string // Path name to store the AttachmentID
Expand All @@ -17,8 +17,8 @@ type UploadAttachment struct {
JSONResult bool // If TRUE, return a JSON structure with result data. This forces Maximum=1
}

// NewUploadAttachment returns a fully parsed UploadAttachment object
func NewUploadAttachment(stepInfo mapof.Any) (UploadAttachment, error) {
// NewUploadAttachments returns a fully parsed UploadAttachments object
func NewUploadAttachments(stepInfo mapof.Any) (UploadAttachments, error) {

// Default behavior is "append". Only other option is "replace"
action := stepInfo.GetString("action")
Expand All @@ -27,7 +27,7 @@ func NewUploadAttachment(stepInfo mapof.Any) (UploadAttachment, error) {
action = "append"
}

return UploadAttachment{
return UploadAttachments{
Action: action,
Fieldname: first(stepInfo.GetString("fieldname"), "form"),
AttachmentPath: stepInfo.GetString("attachment-path"),
Expand All @@ -41,4 +41,4 @@ func NewUploadAttachment(stepInfo mapof.Any) (UploadAttachment, error) {
}

// AmStep is here only to verify that this struct is a build pipeline step
func (step UploadAttachment) AmStep() {}
func (step UploadAttachments) AmStep() {}

0 comments on commit c65ad19

Please sign in to comment.