Refactor everything that's used all over into a common/ package and sync files from static/ into public/ so that public's not in the git.
This commit is contained in:
parent
d12817f4cc
commit
ec7298cce0
36 changed files with 112 additions and 902 deletions
|
@ -5,7 +5,7 @@ import (
|
|||
"strconv"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"zedshaw.games/webapp/data"
|
||||
"zedshaw.games/webapp/api"
|
||||
. "zedshaw.games/webapp/common"
|
||||
)
|
||||
|
||||
func GetApiTableIndex(c *fiber.Ctx) error {
|
||||
|
@ -25,7 +25,7 @@ func GetApiSelectAll(c *fiber.Ctx) error {
|
|||
type_is := data.Models()[table]
|
||||
|
||||
result, err := SelectTable(table, type_is, 20, 0);
|
||||
if err != nil { return api.IfErrNil(err, c) }
|
||||
if err != nil { return IfErrNil(err, c) }
|
||||
|
||||
return c.JSON(result)
|
||||
}
|
||||
|
@ -37,12 +37,12 @@ func GetPageSelectAll(c *fiber.Ctx) error {
|
|||
func GetApiSelectOne(c *fiber.Ctx) error {
|
||||
table := c.Params("table")
|
||||
id, err := strconv.ParseInt(c.Params("id"), 10, 64)
|
||||
if err != nil { return api.IfErrNil(err, c) }
|
||||
if err != nil { return IfErrNil(err, c) }
|
||||
|
||||
type_is := data.Models()[table]
|
||||
|
||||
result, err := Get(table, type_is, id)
|
||||
if err != nil { return api.IfErrNil(err, c) }
|
||||
if err != nil { return IfErrNil(err, c) }
|
||||
|
||||
return c.JSON(result.Interface())
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ func GetApiSelectOne(c *fiber.Ctx) error {
|
|||
func GetPageSelectOne(c *fiber.Ctx) error {
|
||||
table := c.Params("table")
|
||||
id, err := strconv.ParseInt(c.Params("id"), 10, 64)
|
||||
if err != nil { return api.IfErrNil(err, c) }
|
||||
if err != nil { return IfErrNil(err, c) }
|
||||
|
||||
return c.Render("admin/table/view", fiber.Map{
|
||||
"Table": table,
|
||||
|
@ -58,7 +58,6 @@ func GetPageSelectOne(c *fiber.Ctx) error {
|
|||
})
|
||||
}
|
||||
|
||||
|
||||
func PostApiUpdate(c *fiber.Ctx) error {
|
||||
return c.JSON(fiber.Map{})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue