Fix mini-slider admin CRUD JSON encoding and drop seed data from the migration.

Encode title as JSON text so create/list work with pgx, and keep the table migration permission-free so rows are added from admin.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
guwandykandCursor committed 2026-08-18 19:04:48 +05:00
1 parent 82b1e903f6
commit 262292651a
7 files changed
+74 -73

No files matched your search

-24
View File
@@ -1,9 +1,6 @@
package mini_slider
import (
"database/sql/driver"
"encoding/json"
"fmt"
"time"
)
@@ -18,27 +15,6 @@ type Language struct {
En string `json:"en"`
}
func (l Language) Value() (driver.Value, error) {
return json.Marshal(l)
}
func (l *Language) Scan(src interface{}) error {
if src == nil {
*l = Language{}
return nil
}
var b []byte
switch v := src.(type) {
case []byte:
b = v
case string:
b = []byte(v)
default:
return fmt.Errorf("unsupported language type %T", src)
}
return json.Unmarshal(b, l)
}
type MiniSliderListItemDTO struct {
Id int `json:"Id"`
Title Language `json:"title"`