- try clean arch;
This commit is contained in:
parent
fa5ba4742a
commit
0bc1783afd
|
|
@ -0,0 +1,21 @@
|
||||||
|
package workflow
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
"ticket-creator/domain"
|
||||||
|
)
|
||||||
|
|
||||||
|
func ProduceTicket(name string) (string, error) {
|
||||||
|
yt := domain.NewYT(os.Getenv("YT_URL"), os.Getenv("YT_TOKEN"))
|
||||||
|
|
||||||
|
projects, err := yt.GetProjects()
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
issue, err := yt.CreateIssue(projects[1].ID, name)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -8,6 +8,12 @@ import (
|
||||||
"github.com/imroc/req/v3"
|
"github.com/imroc/req/v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type IYouTrack interface {
|
||||||
|
GetProjects() ([]Project, error)
|
||||||
|
CreateIssue(projectID, name string) (*IssueCreateRequest, error)
|
||||||
|
UpdateIssue(issue *IssueCreateRequest, folder, git, gitBuild string) (*IssueUpdateRequest, error)
|
||||||
|
}
|
||||||
|
|
||||||
type youtrack struct {
|
type youtrack struct {
|
||||||
*req.Client
|
*req.Client
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue