From 0bc1783afdccf5318d0585e6a3da7aa5a8c97f78 Mon Sep 17 00:00:00 2001 From: naudachu Date: Sun, 4 Jun 2023 22:32:32 +0500 Subject: [PATCH] - try clean arch; --- controller/workflow.go | 21 +++++++++++++++++++++ domain/yt.go | 6 ++++++ 2 files changed, 27 insertions(+) create mode 100644 controller/workflow.go diff --git a/controller/workflow.go b/controller/workflow.go new file mode 100644 index 0000000..045b344 --- /dev/null +++ b/controller/workflow.go @@ -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 + } + +} diff --git a/domain/yt.go b/domain/yt.go index 4c34f72..1f9119a 100644 --- a/domain/yt.go +++ b/domain/yt.go @@ -8,6 +8,12 @@ import ( "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 { *req.Client }