commit
215a160205
|
@ -2,6 +2,7 @@ package joke
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"strconv"
|
||||||
"jokes-bapak2-api/core/schema"
|
"jokes-bapak2-api/core/schema"
|
||||||
|
|
||||||
"github.com/Masterminds/squirrel"
|
"github.com/Masterminds/squirrel"
|
||||||
|
@ -47,7 +48,7 @@ func SetTotalJoke(db *pgxpool.Pool, ctx context.Context, memory *bigcache.BigCac
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
var total = []byte{byte(len(data))}
|
var total = []byte(strconv.Itoa(len(data)))
|
||||||
err = memory.Set("total", total)
|
err = memory.Set("total", total)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -3,7 +3,6 @@ package joke
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
core "jokes-bapak2-api/core/joke"
|
core "jokes-bapak2-api/core/joke"
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"github.com/allegro/bigcache/v3"
|
"github.com/allegro/bigcache/v3"
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
|
@ -38,6 +37,6 @@ func (d *Dependencies) TotalJokes(c *fiber.Ctx) error {
|
||||||
return c.
|
return c.
|
||||||
Status(fiber.StatusOK).
|
Status(fiber.StatusOK).
|
||||||
JSON(ResponseJoke{
|
JSON(ResponseJoke{
|
||||||
Message: strconv.Itoa(int(total[0])),
|
Message: string(total),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue