- new YT entity to support multiaccounting;
This commit is contained in:
parent
864c583e3c
commit
15cf91aeef
|
|
@ -7,10 +7,11 @@ import (
|
|||
)
|
||||
|
||||
type WorkflowController struct {
|
||||
iGit ext.IGit
|
||||
iCloud ext.ICloud
|
||||
iYouTrack ext.IYouTrack
|
||||
iCoda ext.ICoda
|
||||
iGit ext.IGit
|
||||
iCloud ext.ICloud
|
||||
iYouTrack ext.IYouTrack
|
||||
additionalYT ext.IYouTrack
|
||||
iCoda ext.ICoda
|
||||
}
|
||||
|
||||
func NewWorkflowController(
|
||||
|
|
@ -20,13 +21,16 @@ func NewWorkflowController(
|
|||
cloudAuthUser,
|
||||
cloudAuthPass,
|
||||
ytBaseURL,
|
||||
ytToken string,
|
||||
ytToken,
|
||||
addYTURL,
|
||||
addYTToken string,
|
||||
) *WorkflowController {
|
||||
return &WorkflowController{
|
||||
iGit: ext.NewGit(gitBaseURL, gitToken),
|
||||
iCloud: ext.NewCloud(cloudBaseURL, cloudAuthUser, cloudAuthPass),
|
||||
iYouTrack: ext.NewYT(ytBaseURL, ytToken),
|
||||
iCoda: ext.NewCodaClient(),
|
||||
iGit: ext.NewGit(gitBaseURL, gitToken),
|
||||
iCloud: ext.NewCloud(cloudBaseURL, cloudAuthUser, cloudAuthPass),
|
||||
iYouTrack: ext.NewYT(ytBaseURL, ytToken),
|
||||
additionalYT: ext.NewYT(addYTURL, addYTToken),
|
||||
iCoda: ext.NewCodaClient(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,9 +23,9 @@ func (wc *WorkflowController) NewTask(summ, desc, c, cLink string) *Task {
|
|||
|
||||
func (wc *WorkflowController) CreateTask(t *Task) (*Task, error) {
|
||||
|
||||
yt := wc.iYouTrack
|
||||
yt := wc.additionalYT
|
||||
|
||||
projectID, err := yt.GetProjectIDByName("ETMD")
|
||||
projectID, err := yt.GetProjectIDByName("E")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -38,7 +38,7 @@ func (wc *WorkflowController) CreateTask(t *Task) (*Task, error) {
|
|||
}
|
||||
|
||||
t.Key = issue.Key
|
||||
t.URL = fmt.Sprintf("https://marlerino.youtrack.cloud/issue/%s", issue.Key)
|
||||
t.URL = fmt.Sprintf("https://mobmarlerino.youtrack.cloud/issue/%s", issue.Key)
|
||||
|
||||
return t, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ type Handler struct {
|
|||
workflow controller.IWorkflowController
|
||||
}
|
||||
|
||||
func NewHandler(gitBaseURL, gitToken, cloudBaseURL, cloudAuthUser, cloudAuthPass, ytBaseURL, ytToken string) *Handler {
|
||||
func NewHandler(gitBaseURL, gitToken, cloudBaseURL, cloudAuthUser, cloudAuthPass, ytBaseURL, ytToken, addYTURL, addYTToken string) *Handler {
|
||||
return &Handler{
|
||||
workflow: controller.NewWorkflowController(
|
||||
gitBaseURL,
|
||||
|
|
@ -26,7 +26,10 @@ func NewHandler(gitBaseURL, gitToken, cloudBaseURL, cloudAuthUser, cloudAuthPass
|
|||
cloudAuthUser,
|
||||
cloudAuthPass,
|
||||
ytBaseURL,
|
||||
ytToken),
|
||||
ytToken,
|
||||
addYTURL,
|
||||
addYTToken,
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import (
|
|||
|
||||
func main() {
|
||||
log.Print("started")
|
||||
env(".dev.env")
|
||||
env(".env")
|
||||
ctx := context.Background()
|
||||
|
||||
ctx, cancel := signal.NotifyContext(ctx, os.Interrupt, os.Kill, syscall.SIGTERM)
|
||||
|
|
@ -54,6 +54,8 @@ func runBot(ctx context.Context) error {
|
|||
os.Getenv("CLOUD_PASS"),
|
||||
os.Getenv("YT_URL"),
|
||||
os.Getenv("YT_TOKEN"),
|
||||
os.Getenv("YT_ADDITIONAL_URL"),
|
||||
os.Getenv("YT_ADDITIONAL_TOKEN"),
|
||||
)
|
||||
|
||||
router := tgb.NewRouter().
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
package domain
|
||||
|
||||
type TgUser struct {
|
||||
ID string
|
||||
Name string
|
||||
TgLink string
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
package storage
|
||||
|
||||
import "ticket-pimp/internal/domain"
|
||||
|
||||
type TaskRepository interface {
|
||||
GetOrCreate(tg string) *domain.TgUser
|
||||
}
|
||||
Loading…
Reference in New Issue