From fad708e08d5f265664cf6eaf87a7d4bafdc97384 Mon Sep 17 00:00:00 2001 From: Reinaldy Rafli Date: Tue, 28 Sep 2021 11:29:54 +0700 Subject: [PATCH] chore: running formatter --- api/app/handler/joke/joke_add.go | 2 +- api/main_test.go | 25 ++++++++++++------------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/api/app/handler/joke/joke_add.go b/api/app/handler/joke/joke_add.go index baa6ec8..a5dbb62 100644 --- a/api/app/handler/joke/joke_add.go +++ b/api/app/handler/joke/joke_add.go @@ -54,7 +54,7 @@ func (d *Dependencies) AddNewJoke(c *fiber.Ctx) error { if err != nil && err != pgx.ErrNoRows { return err } - + if err == nil && validateLink != "" { return c.Status(fiber.StatusConflict).JSON(Error{ Error: "Given link is already on the jokesbapak2 database", diff --git a/api/main_test.go b/api/main_test.go index 6d43f5d..12c34ec 100644 --- a/api/main_test.go +++ b/api/main_test.go @@ -44,20 +44,19 @@ func setup() error { } defer db.Close() + dj, err := db.Query(ctx, "DROP TABLE \"jokesbapak2\"") + if err != nil { + log.Println("busy here - 57") + return err + } + defer dj.Close() - dj, err := db.Query(ctx, "DROP TABLE \"jokesbapak2\"") - if err != nil { - log.Println("busy here - 57") - return err - } - defer dj.Close() - - ds, err := db.Query(ctx, "DROP TABLE \"submission\"") - if err != nil { - log.Println("busy here - 67") - return err - } - defer ds.Close() + ds, err := db.Query(ctx, "DROP TABLE \"submission\"") + if err != nil { + log.Println("busy here - 67") + return err + } + defer ds.Close() da, err := db.Query(ctx, "DROP TABLE \"administrators\"") if err != nil {