You've already forked gun-manager-backend
Compare commits
10 Commits
ca56ca7b29
...
f5742527f6
| Author | SHA1 | Date | |
|---|---|---|---|
|
f5742527f6
|
|||
|
e292442e2c
|
|||
|
9c7d3ad787
|
|||
|
dbbeaa05f3
|
|||
|
fdc22b8896
|
|||
|
4c9380c548
|
|||
|
f6528d558f
|
|||
|
345134773f
|
|||
|
7a119a8b60
|
|||
|
04ebe9e855
|
5
.gitignore
vendored
5
.gitignore
vendored
@@ -1,4 +1,7 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
.idea/
|
.idea/
|
||||||
gun_inventory.sqlite
|
*.sqlite
|
||||||
gun-manager
|
gun-manager
|
||||||
|
dist/
|
||||||
|
|
||||||
|
*.gpg
|
||||||
@@ -1,15 +1,12 @@
|
|||||||
package Guns
|
package Guns
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"context"
|
"context"
|
||||||
sql2 "database/sql"
|
sql2 "database/sql"
|
||||||
"git.siteworxpro.com/gun-manager/Handlers"
|
"git.siteworxpro.com/gun-manager/Handlers"
|
||||||
"git.siteworxpro.com/gun-manager/sql"
|
"git.siteworxpro.com/gun-manager/sql"
|
||||||
"git.siteworxpro.com/gun-manager/sql/db"
|
"git.siteworxpro.com/gun-manager/sql/db"
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
"github.com/nfnt/resize"
|
|
||||||
"image/jpeg"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
@@ -27,6 +24,7 @@ type gunPayload struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type gunPost struct {
|
type gunPost struct {
|
||||||
|
Id int64 `json:"id"`
|
||||||
Make string `json:"make" validate:"required"`
|
Make string `json:"make" validate:"required"`
|
||||||
Model string `json:"model" validate:"required"`
|
Model string `json:"model" validate:"required"`
|
||||||
SerialNumber string `json:"serial_number" validate:"required"`
|
SerialNumber string `json:"serial_number" validate:"required"`
|
||||||
@@ -46,24 +44,31 @@ func Post(c echo.Context) error {
|
|||||||
insertRow := db.InsertGunParams{
|
insertRow := db.InsertGunParams{
|
||||||
Make: sql2.NullString{
|
Make: sql2.NullString{
|
||||||
String: gun.Make,
|
String: gun.Make,
|
||||||
|
Valid: true,
|
||||||
},
|
},
|
||||||
Model: sql2.NullString{
|
Model: sql2.NullString{
|
||||||
String: gun.Model,
|
String: gun.Model,
|
||||||
|
Valid: true,
|
||||||
},
|
},
|
||||||
SerialNumber: sql2.NullString{
|
SerialNumber: sql2.NullString{
|
||||||
String: gun.SerialNumber,
|
String: gun.SerialNumber,
|
||||||
|
Valid: true,
|
||||||
},
|
},
|
||||||
PurchaseAmount: sql2.NullInt64{
|
PurchaseAmount: sql2.NullInt64{
|
||||||
Int64: gun.PurchaseAmount,
|
Int64: gun.PurchaseAmount,
|
||||||
|
Valid: true,
|
||||||
},
|
},
|
||||||
ValueAmount: sql2.NullInt64{
|
ValueAmount: sql2.NullInt64{
|
||||||
Int64: gun.ValueAmount,
|
Int64: gun.ValueAmount,
|
||||||
|
Valid: true,
|
||||||
},
|
},
|
||||||
DatePurchased: sql2.NullString{
|
DatePurchased: sql2.NullString{
|
||||||
String: gun.DatePurchased,
|
String: gun.DatePurchased,
|
||||||
|
Valid: true,
|
||||||
},
|
},
|
||||||
Notes: sql2.NullString{
|
Notes: sql2.NullString{
|
||||||
String: gun.Notes,
|
String: gun.Notes,
|
||||||
|
Valid: true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,9 +78,13 @@ func Post(c echo.Context) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = c.JSON(http.StatusAccepted, Handlers.Response[struct{ Id int64 }]{
|
err = c.JSON(http.StatusAccepted, Handlers.Response[struct {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
}]{
|
||||||
Status: http.StatusText(http.StatusOK),
|
Status: http.StatusText(http.StatusOK),
|
||||||
Payload: struct{ Id int64 }{Id: id},
|
Payload: struct {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
}{Id: id},
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -84,44 +93,25 @@ func Post(c echo.Context) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetPhotoResize(c echo.Context) error {
|
func DeleteById(c echo.Context) error {
|
||||||
id, err := strconv.ParseInt(c.Param("id"), 10, 64)
|
id, err := strconv.ParseInt(c.Param("id"), 10, 64)
|
||||||
if err != nil {
|
|
||||||
err := c.JSON(http.StatusNotFound, "")
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
size, err := strconv.ParseInt(c.Param("size"), 10, 64)
|
|
||||||
if err != nil {
|
|
||||||
err := c.JSON(http.StatusNotFound, "")
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
getDb := sql.GetDb()
|
getDb := sql.GetDb()
|
||||||
photo, err := getDb.Queries.GetGunPhotoData(context.Background(), id)
|
err = getDb.Queries.DeleteGunPhotosByGunId(context.Background(), sql2.NullInt64{
|
||||||
|
Int64: id,
|
||||||
|
Valid: true,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = getDb.Queries.DeleteGun(context.Background(), id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
img, err := jpeg.Decode(bytes.NewBuffer(photo))
|
err = c.JSON(http.StatusNoContent, "")
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
m := resize.Resize(uint(size), 0, img, resize.Bicubic)
|
|
||||||
image := bytes.NewBuffer(make([]byte, 0))
|
|
||||||
err = jpeg.Encode(image, m, nil)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
err = c.String(http.StatusOK, image.String())
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -129,23 +119,50 @@ func GetPhotoResize(c echo.Context) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetPhoto(c echo.Context) error {
|
func UpdateGun(c echo.Context) error {
|
||||||
id, err := strconv.ParseInt(c.Param("id"), 10, 64)
|
gun := new(gunPost)
|
||||||
if err != nil {
|
err := c.Bind(gun)
|
||||||
err := c.JSON(http.StatusNotFound, "")
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
getDb := sql.GetDb()
|
getDb := sql.GetDb()
|
||||||
photo, err := getDb.Queries.GetGunPhotoData(context.Background(), id)
|
err = getDb.Queries.UpdateGun(context.Background(), db.UpdateGunParams{
|
||||||
|
Make: sql2.NullString{
|
||||||
|
String: gun.Make,
|
||||||
|
Valid: true,
|
||||||
|
},
|
||||||
|
Model: sql2.NullString{
|
||||||
|
String: gun.Model,
|
||||||
|
Valid: true,
|
||||||
|
},
|
||||||
|
SerialNumber: sql2.NullString{
|
||||||
|
String: gun.SerialNumber,
|
||||||
|
Valid: true,
|
||||||
|
},
|
||||||
|
PurchaseAmount: sql2.NullInt64{
|
||||||
|
Int64: gun.PurchaseAmount,
|
||||||
|
Valid: true,
|
||||||
|
},
|
||||||
|
ValueAmount: sql2.NullInt64{
|
||||||
|
Int64: gun.ValueAmount,
|
||||||
|
Valid: true,
|
||||||
|
},
|
||||||
|
DatePurchased: sql2.NullString{
|
||||||
|
String: gun.DatePurchased,
|
||||||
|
Valid: true,
|
||||||
|
},
|
||||||
|
Notes: sql2.NullString{
|
||||||
|
String: gun.Notes,
|
||||||
|
Valid: true,
|
||||||
|
},
|
||||||
|
ID: gun.Id,
|
||||||
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = c.String(http.StatusOK, string(photo))
|
err = c.JSON(http.StatusOK, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -156,10 +173,6 @@ func GetPhoto(c echo.Context) error {
|
|||||||
func GetById(c echo.Context) error {
|
func GetById(c echo.Context) error {
|
||||||
id, err := strconv.ParseInt(c.Param("id"), 10, 64)
|
id, err := strconv.ParseInt(c.Param("id"), 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err := c.JSON(http.StatusNotFound, "")
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,6 +196,10 @@ func GetById(c echo.Context) error {
|
|||||||
getDb := sql.GetDb()
|
getDb := sql.GetDb()
|
||||||
byId, err := getDb.Queries.GetGunById(context.Background(), id)
|
byId, err := getDb.Queries.GetGunById(context.Background(), id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
err := c.JSON(http.StatusNotFound, "")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
155
Handlers/Guns/photos.go
Normal file
155
Handlers/Guns/photos.go
Normal file
@@ -0,0 +1,155 @@
|
|||||||
|
package Guns
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"context"
|
||||||
|
sql2 "database/sql"
|
||||||
|
"git.siteworxpro.com/gun-manager/sql"
|
||||||
|
"git.siteworxpro.com/gun-manager/sql/db"
|
||||||
|
"github.com/labstack/echo/v4"
|
||||||
|
"github.com/nfnt/resize"
|
||||||
|
"image/jpeg"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetPhotoResize(c echo.Context) error {
|
||||||
|
id, err := strconv.ParseInt(c.Param("id"), 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
err := c.JSON(http.StatusNotFound, "")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
size, err := strconv.ParseInt(c.Param("size"), 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
err := c.JSON(http.StatusNotFound, "")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
getDb := sql.GetDb()
|
||||||
|
photo, err := getDb.Queries.GetGunPhotoData(context.Background(), id)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
img, err := jpeg.Decode(bytes.NewBuffer(photo))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
m := resize.Resize(uint(size), 0, img, resize.Bicubic)
|
||||||
|
image := bytes.NewBuffer(make([]byte, 0))
|
||||||
|
err = jpeg.Encode(image, m, nil)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = c.String(http.StatusOK, image.String())
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func DeletePhoto(c echo.Context) error {
|
||||||
|
id, err := strconv.ParseInt(c.Param("id"), 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
getDb := sql.GetDb()
|
||||||
|
err = getDb.Queries.DeleteGunPhotosById(context.Background(), id)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = c.JSON(http.StatusNoContent, "")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func PostPhoto(c echo.Context) error {
|
||||||
|
id, err := strconv.ParseInt(c.Param("id"), 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
err := c.JSON(http.StatusNotFound, "")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
files, err := c.MultipartForm()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
getDb := sql.GetDb()
|
||||||
|
byId, err := getDb.Queries.GetGunById(context.Background(), id)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, handler := range files.File {
|
||||||
|
for _, file := range handler {
|
||||||
|
open, err := file.Open()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
fileData := make([]byte, file.Size)
|
||||||
|
_, err = open.Read(fileData)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = getDb.Queries.InsertGunPhoto(context.Background(), db.InsertGunPhotoParams{
|
||||||
|
GunID: sql2.NullInt64{
|
||||||
|
Int64: byId.ID,
|
||||||
|
Valid: true,
|
||||||
|
},
|
||||||
|
Filename: sql2.NullString{
|
||||||
|
String: file.Filename,
|
||||||
|
Valid: true,
|
||||||
|
},
|
||||||
|
Photo: fileData,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetPhoto(c echo.Context) error {
|
||||||
|
id, err := strconv.ParseInt(c.Param("id"), 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
err := c.JSON(http.StatusNotFound, "")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
getDb := sql.GetDb()
|
||||||
|
photo, err := getDb.Queries.GetGunPhotoData(context.Background(), id)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = c.String(http.StatusOK, string(photo))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
27
go.mod
27
go.mod
@@ -1,23 +1,24 @@
|
|||||||
module git.siteworxpro.com/gun-manager
|
module git.siteworxpro.com/gun-manager
|
||||||
|
|
||||||
go 1.19
|
go 1.24.4
|
||||||
|
|
||||||
|
toolchain go1.24.4
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/labstack/echo/v4 v4.11.1
|
github.com/labstack/echo/v4 v4.13.4
|
||||||
github.com/mattn/go-sqlite3 v1.14.16
|
github.com/mattn/go-sqlite3 v1.14.29
|
||||||
|
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
|
github.com/labstack/gommon v0.4.2 // indirect
|
||||||
github.com/labstack/gommon v0.4.0 // indirect
|
github.com/mattn/go-colorable v0.1.14 // indirect
|
||||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.19 // indirect
|
|
||||||
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 // indirect
|
|
||||||
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
||||||
github.com/valyala/fasttemplate v1.2.2 // indirect
|
github.com/valyala/fasttemplate v1.2.2 // indirect
|
||||||
golang.org/x/crypto v0.11.0 // indirect
|
golang.org/x/crypto v0.40.0 // indirect
|
||||||
golang.org/x/net v0.12.0 // indirect
|
golang.org/x/net v0.42.0 // indirect
|
||||||
golang.org/x/sys v0.10.0 // indirect
|
golang.org/x/sys v0.34.0 // indirect
|
||||||
golang.org/x/text v0.11.0 // indirect
|
golang.org/x/text v0.27.0 // indirect
|
||||||
golang.org/x/time v0.3.0 // indirect
|
golang.org/x/time v0.12.0 // indirect
|
||||||
)
|
)
|
||||||
|
|||||||
42
go.sum
42
go.sum
@@ -5,17 +5,27 @@ github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keL
|
|||||||
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
|
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
|
||||||
github.com/labstack/echo/v4 v4.11.1 h1:dEpLU2FLg4UVmvCGPuk/APjlH6GDpbEPti61srUUUs4=
|
github.com/labstack/echo/v4 v4.11.1 h1:dEpLU2FLg4UVmvCGPuk/APjlH6GDpbEPti61srUUUs4=
|
||||||
github.com/labstack/echo/v4 v4.11.1/go.mod h1:YuYRTSM3CHs2ybfrL8Px48bO6BAnYIN4l8wSTMP6BDQ=
|
github.com/labstack/echo/v4 v4.11.1/go.mod h1:YuYRTSM3CHs2ybfrL8Px48bO6BAnYIN4l8wSTMP6BDQ=
|
||||||
|
github.com/labstack/echo/v4 v4.13.4 h1:oTZZW+T3s9gAu5L8vmzihV7/lkXGZuITzTQkTEhcXEA=
|
||||||
|
github.com/labstack/echo/v4 v4.13.4/go.mod h1:g63b33BZ5vZzcIUF8AtRH40DrTlXnx4UMC8rBdndmjQ=
|
||||||
github.com/labstack/gommon v0.4.0 h1:y7cvthEAEbU0yHOf4axH8ZG2NH8knB9iNSoTO8dyIk8=
|
github.com/labstack/gommon v0.4.0 h1:y7cvthEAEbU0yHOf4axH8ZG2NH8knB9iNSoTO8dyIk8=
|
||||||
github.com/labstack/gommon v0.4.0/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM=
|
github.com/labstack/gommon v0.4.0/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM=
|
||||||
|
github.com/labstack/gommon v0.4.2 h1:F8qTUNXgG1+6WQmqoUWnz8WiEU60mXVVw0P4ht1WRA0=
|
||||||
|
github.com/labstack/gommon v0.4.2/go.mod h1:QlUFxVM+SNXhDL/Z7YhocGIBYOiwB0mXm1+1bAPHPyU=
|
||||||
github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
|
github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
|
||||||
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
||||||
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
||||||
|
github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
|
||||||
|
github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
|
||||||
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
||||||
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||||
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
|
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
|
||||||
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||||
github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y=
|
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||||
github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
|
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||||
|
github.com/mattn/go-sqlite3 v1.14.17 h1:mCRHCLDUBXgpKAqIKsaAaAsrAlbkeomtRFKXh2L6YIM=
|
||||||
|
github.com/mattn/go-sqlite3 v1.14.17/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
|
||||||
|
github.com/mattn/go-sqlite3 v1.14.29 h1:1O6nRLJKvsi1H2Sj0Hzdfojwt8GiGKm+LOfLaBFaouQ=
|
||||||
|
github.com/mattn/go-sqlite3 v1.14.29/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
|
||||||
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ=
|
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ=
|
||||||
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8=
|
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
@@ -23,27 +33,39 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
|
|||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
|
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
|
||||||
|
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||||
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
||||||
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
||||||
github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
|
github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
|
||||||
github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo=
|
github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo=
|
||||||
github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
|
github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
|
||||||
golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA=
|
golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk=
|
||||||
golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio=
|
golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw=
|
||||||
golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50=
|
golang.org/x/crypto v0.40.0 h1:r4x+VvoG5Fm+eJcxMaY8CQM7Lb0l1lsmjGBQ6s8BfKM=
|
||||||
golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA=
|
golang.org/x/crypto v0.40.0/go.mod h1:Qr1vMER5WyS2dfPHAlsOj01wgLbsyWtFn/aY+5+ZdxY=
|
||||||
|
golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14=
|
||||||
|
golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
|
||||||
|
golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs=
|
||||||
|
golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8=
|
||||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=
|
golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
|
||||||
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4=
|
golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA=
|
||||||
golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||||
|
golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc=
|
||||||
|
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||||
|
golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4=
|
||||||
|
golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU=
|
||||||
golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4=
|
golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4=
|
||||||
golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||||
|
golang.org/x/time v0.12.0 h1:ScB/8o8olJvc+CQPWrK3fPZNfh7qgwCrY0zJmoEQLSE=
|
||||||
|
golang.org/x/time v0.12.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
|||||||
22
main.go
22
main.go
@@ -11,18 +11,17 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
var dbfile string
|
var dbFile string
|
||||||
|
|
||||||
flag.StringVar(&dbfile, "database", "", "the database file to load")
|
flag.StringVar(&dbFile, "database", "", "the database file to load")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
if dbfile == "" {
|
if dbFile == "" {
|
||||||
flag.Usage()
|
flag.Usage()
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err := sql.NewDb(dbfile)
|
_, err := sql.NewDb(dbFile)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
@@ -31,14 +30,25 @@ func main() {
|
|||||||
e.Use(middleware.Logger())
|
e.Use(middleware.Logger())
|
||||||
e.Use(middleware.Recover())
|
e.Use(middleware.Recover())
|
||||||
e.Use(middleware.CORSWithConfig(middleware.CORSConfig{
|
e.Use(middleware.CORSWithConfig(middleware.CORSConfig{
|
||||||
AllowOrigins: []string{"localhost"},
|
AllowOrigins: []string{
|
||||||
|
"http://127.0.0.1:5173",
|
||||||
|
"http://localhost:5173",
|
||||||
|
"http://127.0.0.1:4173",
|
||||||
|
"http://127.0.0.1:8000",
|
||||||
|
},
|
||||||
AllowMethods: nil,
|
AllowMethods: nil,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
e.Static("/", "dist")
|
||||||
|
|
||||||
e.GET("/gun", Guns.Get)
|
e.GET("/gun", Guns.Get)
|
||||||
|
e.PUT("/gun/:id", Guns.UpdateGun)
|
||||||
e.GET("/gun/:id", Guns.GetById)
|
e.GET("/gun/:id", Guns.GetById)
|
||||||
|
e.DELETE("/gun/:id", Guns.DeleteById)
|
||||||
e.POST("/gun", Guns.Post)
|
e.POST("/gun", Guns.Post)
|
||||||
e.GET("/gun/photo/:id/:filename", Guns.GetPhoto)
|
e.GET("/gun/photo/:id/:filename", Guns.GetPhoto)
|
||||||
|
e.POST("/gun/photo/:id", Guns.PostPhoto)
|
||||||
|
e.DELETE("/gun/photo/:id", Guns.DeletePhoto)
|
||||||
e.GET("/gun/photo/:id/:size/:filename", Guns.GetPhotoResize)
|
e.GET("/gun/photo/:id/:size/:filename", Guns.GetPhotoResize)
|
||||||
|
|
||||||
e.Logger.Fatal(e.Start(":8000"))
|
e.Logger.Fatal(e.Start(":8000"))
|
||||||
|
|||||||
@@ -10,6 +10,33 @@ import (
|
|||||||
"database/sql"
|
"database/sql"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const deleteGun = `-- name: DeleteGun :exec
|
||||||
|
DELETE from guns where id = ?
|
||||||
|
`
|
||||||
|
|
||||||
|
func (q *Queries) DeleteGun(ctx context.Context, id int64) error {
|
||||||
|
_, err := q.db.ExecContext(ctx, deleteGun, id)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
const deleteGunPhotosByGunId = `-- name: DeleteGunPhotosByGunId :exec
|
||||||
|
DELETE FROM photos where gun_id = ?
|
||||||
|
`
|
||||||
|
|
||||||
|
func (q *Queries) DeleteGunPhotosByGunId(ctx context.Context, gunID sql.NullInt64) error {
|
||||||
|
_, err := q.db.ExecContext(ctx, deleteGunPhotosByGunId, gunID)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
const deleteGunPhotosById = `-- name: DeleteGunPhotosById :exec
|
||||||
|
DELETE FROM photos where id = ?
|
||||||
|
`
|
||||||
|
|
||||||
|
func (q *Queries) DeleteGunPhotosById(ctx context.Context, id int64) error {
|
||||||
|
_, err := q.db.ExecContext(ctx, deleteGunPhotosById, id)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
const getAllGuns = `-- name: GetAllGuns :many
|
const getAllGuns = `-- name: GetAllGuns :many
|
||||||
SELECT id, make, model, value_amount
|
SELECT id, make, model, value_amount
|
||||||
from guns
|
from guns
|
||||||
@@ -146,3 +173,49 @@ func (q *Queries) InsertGun(ctx context.Context, arg InsertGunParams) (int64, er
|
|||||||
err := row.Scan(&id)
|
err := row.Scan(&id)
|
||||||
return id, err
|
return id, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const insertGunPhoto = `-- name: InsertGunPhoto :exec
|
||||||
|
INSERT into photos (gun_id, photo, filename) values (?, ?, ?)
|
||||||
|
`
|
||||||
|
|
||||||
|
type InsertGunPhotoParams struct {
|
||||||
|
GunID sql.NullInt64 `json:"gun_id"`
|
||||||
|
Photo []byte `json:"photo"`
|
||||||
|
Filename sql.NullString `json:"filename"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (q *Queries) InsertGunPhoto(ctx context.Context, arg InsertGunPhotoParams) error {
|
||||||
|
_, err := q.db.ExecContext(ctx, insertGunPhoto, arg.GunID, arg.Photo, arg.Filename)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
const updateGun = `-- name: UpdateGun :exec
|
||||||
|
UPDATE guns
|
||||||
|
set make = ?, model = ?, serial_number = ?, purchase_amount = ?, value_amount = ?, date_purchased = ?, notes = ?
|
||||||
|
where id = ?
|
||||||
|
`
|
||||||
|
|
||||||
|
type UpdateGunParams struct {
|
||||||
|
Make sql.NullString `json:"make"`
|
||||||
|
Model sql.NullString `json:"model"`
|
||||||
|
SerialNumber sql.NullString `json:"serial_number"`
|
||||||
|
PurchaseAmount sql.NullInt64 `json:"purchase_amount"`
|
||||||
|
ValueAmount sql.NullInt64 `json:"value_amount"`
|
||||||
|
DatePurchased sql.NullString `json:"date_purchased"`
|
||||||
|
Notes sql.NullString `json:"notes"`
|
||||||
|
ID int64 `json:"id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (q *Queries) UpdateGun(ctx context.Context, arg UpdateGunParams) error {
|
||||||
|
_, err := q.db.ExecContext(ctx, updateGun,
|
||||||
|
arg.Make,
|
||||||
|
arg.Model,
|
||||||
|
arg.SerialNumber,
|
||||||
|
arg.PurchaseAmount,
|
||||||
|
arg.ValueAmount,
|
||||||
|
arg.DatePurchased,
|
||||||
|
arg.Notes,
|
||||||
|
arg.ID,
|
||||||
|
)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|||||||
@@ -17,5 +17,21 @@ order by id desc;
|
|||||||
-- name: InsertGun :one
|
-- name: InsertGun :one
|
||||||
INSERT into guns
|
INSERT into guns
|
||||||
(make, model, serial_number, purchase_amount, value_amount, date_purchased, notes) VALUES
|
(make, model, serial_number, purchase_amount, value_amount, date_purchased, notes) VALUES
|
||||||
(?, ?, ?, ?, ?, ?, ?) returning id
|
(?, ?, ?, ?, ?, ?, ?) returning id;
|
||||||
|
|
||||||
|
-- name: UpdateGun :exec
|
||||||
|
UPDATE guns
|
||||||
|
set make = ?, model = ?, serial_number = ?, purchase_amount = ?, value_amount = ?, date_purchased = ?, notes = ?
|
||||||
|
where id = ?;
|
||||||
|
|
||||||
|
-- name: DeleteGun :exec
|
||||||
|
DELETE from guns where id = ?;
|
||||||
|
|
||||||
|
-- name: DeleteGunPhotosByGunId :exec
|
||||||
|
DELETE FROM photos where gun_id = ?;
|
||||||
|
|
||||||
|
-- name: DeleteGunPhotosById :exec
|
||||||
|
DELETE FROM photos where id = ?;
|
||||||
|
|
||||||
|
-- name: InsertGunPhoto :exec
|
||||||
|
INSERT into photos (gun_id, photo, filename) values (?, ?, ?);
|
||||||
Reference in New Issue
Block a user