From 40fcb5896a878a7a08c96d76b64461a2972832f7 Mon Sep 17 00:00:00 2001 From: naudachu Date: Sun, 3 Dec 2023 17:02:47 +0500 Subject: [PATCH] - fixed problem with empty project; --- cmd/main.go | 10 ---------- internal/controller/control_coda.go | 6 +++++- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/cmd/main.go b/cmd/main.go index 6cc7258..0a9e9d9 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -23,17 +23,7 @@ import ( "golang.org/x/sync/errgroup" ) -<<<<<<< HEAD -const ( - envfile = "prod.env" - migrationfile = "../internal/storage/migrate" - // production env: - // envfile = "../docker/prod.env" - // migrationfile = "../internal/storage/migrate" -) -======= const migrationfile = "../internal/storage/migrate" ->>>>>>> dev func main() { log.Print("started") diff --git a/internal/controller/control_coda.go b/internal/controller/control_coda.go index b0798ed..7213741 100644 --- a/internal/controller/control_coda.go +++ b/internal/controller/control_coda.go @@ -2,6 +2,7 @@ package controller import ( "context" + "errors" "fmt" "ticket-pimp/internal/domain" ) @@ -13,6 +14,10 @@ func (wc *WorkflowController) CreateCoda(guildID string, chanID string) (string, return "", err } + if p == nil { + return "", errors.New("project wasn't found in the db") + } + requestResult, err := wc.ICoda.CreateApp(domain.CodaApplication{ ID: p.Key, Summary: p.Name, @@ -23,5 +28,4 @@ func (wc *WorkflowController) CreateCoda(guildID string, chanID string) (string, }) return requestResult, err - }