- try clean arch;

This commit is contained in:
naudachu 2023-06-04 22:32:32 +05:00
parent fa5ba4742a
commit 0bc1783afd
2 changed files with 27 additions and 0 deletions

21
controller/workflow.go Normal file
View File

@ -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
}
}

View File

@ -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
}