chore: some more clean up

This commit is contained in:
2024-04-14 14:51:16 +01:00
parent fbf7eb9271
commit 8b13afba48
18 changed files with 483 additions and 479 deletions

View File

@@ -3,7 +3,7 @@ package model_classes
import (
"strconv"
"git.andr3h3nriqu3s.com/andr3/fyp/logic/utils"
. "git.andr3h3nriqu3s.com/andr3/fyp/logic/db_types"
. "git.andr3h3nriqu3s.com/andr3/fyp/logic/utils"
)
@@ -33,7 +33,7 @@ func HandleList(handle *Handle) {
Model_id string
}
err = utils.GetDBOnce(c, &class_row, "model_classes where id=$1", id)
err = GetDBOnce(c, &class_row, "model_classes where id=$1", id)
if err == NotFoundError {
return c.JsonBadRequest("Model Class not found!")
} else if err != nil {
@@ -47,7 +47,7 @@ func HandleList(handle *Handle) {
Status int `json:"status"`
}
rows, err := utils.GetDbMultitple[baserow](c, "model_data_point where class_id=$1 limit 11 offset $2", id, page*10)
rows, err := GetDbMultitple[baserow](c, "model_data_point where class_id=$1 limit 11 offset $2", id, page*10)
if err != nil {
return c.Error500(err)
}
@@ -60,7 +60,7 @@ func HandleList(handle *Handle) {
max_len := min(11, len(rows))
c.ShowMessage = false;
c.ShowMessage = false
return c.SendJSON(ReturnType{
ImageList: rows[0:max_len],
Page: page,

View File

@@ -4,7 +4,8 @@ import (
"database/sql"
"errors"
. "git.andr3h3nriqu3s.com/andr3/fyp/logic/utils"
. "git.andr3h3nriqu3s.com/andr3/fyp/logic/db_types"
. "git.andr3h3nriqu3s.com/andr3/fyp/logic/utils"
)
type ModelClass struct {
@@ -15,7 +16,7 @@ type ModelClass struct {
}
func ListClasses(c *Context, model_id string) (cls []*ModelClass, err error) {
return GetDbMultitple[ModelClass](c, "model_classes where model_id=$1", model_id)
return GetDbMultitple[ModelClass](c, "model_classes where model_id=$1", model_id)
}
func ModelHasDataPoints(db *sql.DB, model_id string) (result bool, err error) {