Add mini-slider API and wire the homepage projects carousel.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
86b51059f3
commit
b33fea4cd7
19 files changed
+563
-28
No files matched your search
@@ -0,0 +1,64 @@
|
||||
package mini_slider
|
||||
|
||||
import (
|
||||
"database/sql/driver"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
type DataMiniSliderDTO struct {
|
||||
MiniSliders []MiniSliderListItemDTO `json:"miniSliders"`
|
||||
Count int `json:"count"`
|
||||
}
|
||||
|
||||
type Language struct {
|
||||
Tm string `json:"tm"`
|
||||
Ru string `json:"ru"`
|
||||
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"`
|
||||
Image string `json:"imagePath"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
}
|
||||
|
||||
type GetMiniSliderDTO struct {
|
||||
Id int `json:"Id"`
|
||||
Title Language `json:"title"`
|
||||
Image string `json:"imagePath"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
}
|
||||
|
||||
type AddMiniSliderDTO struct {
|
||||
Title Language `json:"title" binding:"required"`
|
||||
Image string `json:"imagePath"`
|
||||
}
|
||||
|
||||
type UpdateMiniSliderDTO struct {
|
||||
Title Language `json:"title" binding:"required"`
|
||||
Image string `json:"imagePath"`
|
||||
}
|
||||
Reference in new issue
Block a user