fix POST to GET
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-01-10 11:35:22 +11:00
parent 4b44c93693
commit 0273f62611
2 changed files with 7 additions and 4 deletions

View File

@@ -259,7 +259,7 @@ func main() {
// Other functions for admin
adminOnly.POST("/unlock", controllers.Unlock)
adminOnly.POST("/safe/listall", controllers.GetAllSafesHandler)
adminOnly.GET("/safe/listall", controllers.GetAllSafesHandler)
// Deprecated
//adminOnly.GET("/roles", controllers.GetRoles)

View File

@@ -3,6 +3,7 @@ package models
import (
"errors"
"log"
"smt/utils"
)
type Safe struct {
@@ -63,7 +64,7 @@ func SafeListAllowed(userId int) ([]Safe, error) {
`, userId, userId)
if err != nil {
log.Printf("SafeList error executing sql record : '%s'\n", err)
log.Printf("SafeListAllowed error executing sql record : '%s'\n", err)
return results, err
} else {
// parse all the results into a slice
@@ -71,13 +72,15 @@ func SafeListAllowed(userId int) ([]Safe, error) {
var s Safe
err = rows.StructScan(&s)
if err != nil {
log.Printf("SafeList error parsing sql record : '%s'\n", err)
log.Printf("SafeListAllowed error parsing sql record : '%s'\n", err)
return results, err
}
results = append(results, s)
debugPrint := utils.PrintStructContents(&s, 0)
log.Printf("SafeListAllowed adding record :\n%s\n", debugPrint)
}
log.Printf("SafeList retrieved '%d' results\n", len(results))
log.Printf("SafeListAllowed retrieved '%d' results\n", len(results))
}
return results, nil