fix tpyo
Some checks failed
🧪 ✨ Unit Tests Workflow / 🔍 🐹 Go Tests (push) Failing after 6m19s
🧪 ✨ Unit Tests Workflow / 🧪 📜 JavaScript Tests (push) Successful in 8m22s
🧪 ✨ Unit Tests Workflow / 🧪 🐹 GolangCI-Lint (push) Failing after 9m52s

This commit is contained in:
2025-06-10 08:14:17 -04:00
parent e484aa7e31
commit d1dc5897c5
15 changed files with 158 additions and 34 deletions

View File

@@ -21,7 +21,10 @@ type BulletResponse struct {
func Photo(c echo.Context) error {
db := c.(*database.CustomContext).Db
defer db.Db.Close(context.Background())
defer func() {
_ = db.Db.Close(context.Background())
}()
id := c.Param("id")
uid := handlers.ParseUuidOrBadRequest(c, id)
@@ -48,7 +51,10 @@ func Photo(c echo.Context) error {
func Delete(c echo.Context) error {
db := c.(*database.CustomContext).Db
defer db.Db.Close(context.Background())
defer func() {
_ = db.Db.Close(context.Background())
}()
id := c.Param("id")
uid := handlers.ParseUuidOrBadRequest(c, id)
@@ -66,7 +72,9 @@ func Delete(c echo.Context) error {
func Put(c echo.Context) error {
db := c.(*database.CustomContext).Db
defer db.Db.Close(context.Background())
defer func() {
_ = db.Db.Close(context.Background())
}()
id := c.Param("id")
uid := handlers.ParseUuidOrBadRequest(c, id)
@@ -147,7 +155,9 @@ func Put(c echo.Context) error {
func Get(c echo.Context) error {
db := c.(*database.CustomContext).Db
defer db.Db.Close(context.Background())
defer func() {
_ = db.Db.Close(context.Background())
}()
if c.Param("id") != "" {
id := c.Param("id")
@@ -210,7 +220,6 @@ func Get(c echo.Context) error {
}
func Post(c echo.Context) error {
file, err := c.FormFile("photo")
if err != nil {
c.Logger().Error(err)
@@ -245,7 +254,9 @@ func Post(c echo.Context) error {
}
db := c.(*database.CustomContext).Db
defer db.Db.Close(context.Background())
defer func() {
_ = db.Db.Close(context.Background())
}()
manufacturerUid := handlers.ParseUuidOrBadRequest(c, manufacturerId)
if manufacturerUid == nil {

View File

@@ -22,7 +22,9 @@ type postRequest struct {
func Get(c echo.Context) error {
db := c.(*database.CustomContext).Db
defer db.Db.Close(context.Background())
defer func() {
_ = db.Db.Close(context.Background())
}()
cartridges, err := db.Loads.GetCartridges(context.Background())
if err != nil {
@@ -45,7 +47,9 @@ func Get(c echo.Context) error {
func Post(c echo.Context) error {
db := c.(*database.CustomContext).Db
defer db.Db.Close(context.Background())
defer func() {
_ = db.Db.Close(context.Background())
}()
req := postRequest{}
@@ -79,7 +83,9 @@ func Post(c echo.Context) error {
func Delete(c echo.Context) error {
db := c.(*database.CustomContext).Db
defer db.Db.Close(context.Background())
defer func() {
_ = db.Db.Close(context.Background())
}()
uid := handlers.ParseUuidOrBadRequest(c, c.Param("id"))
if uid == nil {

View File

@@ -66,7 +66,9 @@ type ResultChan[T any] struct {
func Post(c echo.Context) error {
db := c.(*database.CustomContext).Db
defer db.Db.Close(context.Background())
defer func() {
_ = db.Db.Close(context.Background())
}()
cartridgeID, err := handlers.ParseUuid(c.FormValue("cartridge_id"))
if err != nil {
@@ -136,7 +138,6 @@ func Post(c echo.Context) error {
}
func Get(c echo.Context) error {
id := c.Param("id")
cResults := make(chan ResultChan[[]loadResponseResults])
@@ -182,7 +183,6 @@ func Get(c echo.Context) error {
} else {
ch <- ResultChan[int64]{Result: total}
}
}(cTotal)
go execResultsQuery(cResults, c)

View File

@@ -21,7 +21,9 @@ type manufacturerResponse struct {
func Get(c echo.Context) error {
db := c.(*database.CustomContext).Db
defer db.Db.Close(context.Background())
defer func() {
_ = db.Db.Close(context.Background())
}()
if c.Param("id") != "" {
id := c.Param("id")
@@ -73,7 +75,9 @@ func Get(c echo.Context) error {
func Delete(c echo.Context) error {
db := c.(*database.CustomContext).Db
defer db.Db.Close(context.Background())
defer func() {
_ = db.Db.Close(context.Background())
}()
id := c.Param("id")
uid := handlers.ParseUuidOrBadRequest(c, id)
@@ -97,7 +101,9 @@ func Delete(c echo.Context) error {
func Post(c echo.Context) error {
db := c.(*database.CustomContext).Db
defer db.Db.Close(context.Background())
defer func() {
_ = db.Db.Close(context.Background())
}()
if c.Param("id") != "" {
id := c.Param("id")

View File

@@ -13,7 +13,9 @@ import (
func Photo(c echo.Context) error {
db := c.(*database.CustomContext).Db
defer db.Db.Close(context.Background())
defer func() {
_ = db.Db.Close(context.Background())
}()
id := c.Param("id")
uid, err := handlers.ParseUuid(id)
@@ -41,7 +43,9 @@ func Photo(c echo.Context) error {
func Delete(c echo.Context) error {
id := c.Param("id")
db := c.(*database.CustomContext).Db
defer db.Db.Close(context.Background())
defer func() {
_ = db.Db.Close(context.Background())
}()
uid, err := handlers.ParseUuid(id)
if err != nil {
@@ -58,7 +62,9 @@ func Delete(c echo.Context) error {
func Post(c echo.Context) error {
db := c.(*database.CustomContext).Db
defer db.Db.Close(context.Background())
defer func() {
_ = db.Db.Close(context.Background())
}()
if c.Param("id") != "" {
id := c.Param("id")
@@ -163,7 +169,9 @@ func Post(c echo.Context) error {
func Get(c echo.Context) error {
db := c.(*database.CustomContext).Db
defer db.Db.Close(context.Background())
defer func() {
_ = db.Db.Close(context.Background())
}()
if c.Param("id") != "" {
id := c.Param("id")

View File

@@ -19,7 +19,9 @@ type PrimerResponse struct {
func Delete(c echo.Context) error {
db := c.(*database.CustomContext).Db
defer db.Db.Close(context.Background())
defer func() {
_ = db.Db.Close(context.Background())
}()
id := c.Param("id")
uid, err := handlers.ParseUuid(id)
@@ -37,7 +39,9 @@ func Delete(c echo.Context) error {
func Post(c echo.Context) error {
db := c.(*database.CustomContext).Db
defer db.Db.Close(context.Background())
defer func() {
_ = db.Db.Close(context.Background())
}()
if c.Param("id") != "" {
id := c.Param("id")
@@ -112,7 +116,8 @@ func Post(c echo.Context) error {
if metaString == "" {
metaString = "{}"
}
var meta json.RawMessage = []byte(metaString)
meta := []byte(metaString)
newUuid := uuid.New().String()
uid, _ := handlers.ParseUuid(newUuid)
@@ -145,7 +150,9 @@ func Post(c echo.Context) error {
func Photo(c echo.Context) error {
db := c.(*database.CustomContext).Db
defer db.Db.Close(context.Background())
defer func() {
_ = db.Db.Close(context.Background())
}()
id := c.Param("id")
uid := handlers.ParseUuidOrBadRequest(c, id)
@@ -172,7 +179,9 @@ func Photo(c echo.Context) error {
func Get(c echo.Context) error {
db := c.(*database.CustomContext).Db
defer db.Db.Close(context.Background())
defer func() {
_ = db.Db.Close(context.Background())
}()
if c.Param("id") != "" {
id := c.Param("id")

View File

@@ -11,7 +11,6 @@ type TestContext struct {
}
func (t TestContext) JSON(code int, i interface{}) error {
if code != 400 {
t.t.Fatal("expected 400")
}

View File

@@ -41,5 +41,4 @@ func ParseUuidOrBadRequest(c echo.Context, s string) *pgtype.UUID {
}
return uid
}