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

@@ -7,6 +7,7 @@ import (
"os"
"path"
. "git.andr3h3nriqu3s.com/andr3/fyp/logic/db_types"
. "git.andr3h3nriqu3s.com/andr3/fyp/logic/models"
. "git.andr3h3nriqu3s.com/andr3/fyp/logic/models/utils"
. "git.andr3h3nriqu3s.com/andr3/fyp/logic/tasks/utils"
@@ -46,7 +47,7 @@ func handleUpload(handler *Handle) {
var requestData struct {
ModelId string `json:"id" validate:"required"`
}
_err := c.ParseJson(&requestData, json_data)
if _err != nil {
return _err
@@ -115,7 +116,7 @@ func handleUpload(handler *Handle) {
Id string `json:"task_id"`
} { "Provided image does not match the model", id})
}
UpdateStatus(c, "tasks", id, 1)
return c.SendJSON(struct {Id string `json:"id"`}{id})

View File

@@ -1,6 +1,7 @@
package tasks
import (
. "git.andr3h3nriqu3s.com/andr3/fyp/logic/db_types"
dbtypes "git.andr3h3nriqu3s.com/andr3/fyp/logic/db_types"
. "git.andr3h3nriqu3s.com/andr3/fyp/logic/models/utils"
. "git.andr3h3nriqu3s.com/andr3/fyp/logic/tasks/utils"

View File

@@ -8,9 +8,10 @@ import (
"github.com/charmbracelet/log"
. "git.andr3h3nriqu3s.com/andr3/fyp/logic/utils"
. "git.andr3h3nriqu3s.com/andr3/fyp/logic/db_types"
. "git.andr3h3nriqu3s.com/andr3/fyp/logic/models"
. "git.andr3h3nriqu3s.com/andr3/fyp/logic/tasks/utils"
. "git.andr3h3nriqu3s.com/andr3/fyp/logic/models"
. "git.andr3h3nriqu3s.com/andr3/fyp/logic/utils"
)
/**
@@ -36,13 +37,13 @@ func runner(db *sql.DB, task_channel chan Task, index int, back_channel chan int
var err error
base := BasePackStruct{
Db: db,
Db: db,
Logger: logger,
}
for task := range task_channel {
logger.Info("Got task", "task", task)
if task.TaskType == int(TASK_TYPE_CLASSIFICATION) {
logger.Info("Classification Task")
if err = ClassifyTask(base, task); err != nil {
@@ -80,7 +81,7 @@ func attentionSeeker(config Config, back_channel chan int) {
for true {
back_channel <- 0
time.Sleep(t)
}
}

View File

@@ -3,7 +3,7 @@ package tasks_utils
import (
"time"
. "git.andr3h3nriqu3s.com/andr3/fyp/logic/utils"
. "git.andr3h3nriqu3s.com/andr3/fyp/logic/db_types"
"github.com/goccy/go-json"
)