Story

In the 'story.go' file, change the struct and constructor to:

type storyService struct {
	txProvider     database.TxProvider
	repo           repositories.StoryRepo
	cerberusClient cerberus.CerberusClient
}

func NewStoryService(
	txProvider database.TxProvider,
	repo repositories.StoryRepo,
	cerberusClient cerberus.CerberusClient) StoryService {
	return &storyService{
		txProvider:     txProvider,
		repo:           repo,
		cerberusClient: cerberusClient,
	}
}

And the 'Create' function:

.
.
.
err = s.cerberusClient.ExecuteWithCtx(ctx, s.cerberusClient.CreateResourceCmd(story.Id, sprintId, common.Story_RT))
if err != nil {
	if rbe := tx.Rollback(); rbe != nil {
		err = fmt.Errorf("rollback error (%v) after %w", rbe, err)
	}
	return repositories.Story{}, err
}

return story, tx.Commit()

Last updated