38 lines
960 B
Go
Raw Normal View History

2024-08-03 20:01:25 +07:00
package request
import (
2025-03-04 20:36:17 +07:00
"enaklo-pos-be/internal/entity"
2024-08-03 20:01:25 +07:00
)
type DiscoveryHomeParam struct {
Lat float64 `form:"lat" json:"lat" example:"10"`
Long float64 `form:"long" json:"long" example:"0"`
Name string `form:"name" json:"name" example:"0"`
Region string `form:"region" json:"region" example:"0"`
Radius int `form:"radius" json:"radius" example:"0"`
Limit int `form:"limit" json:"limit" example:"0"`
Offset int `form:"offset" json:"offset" example:"0"`
Discover string `form:"discover" json:"discover" example:"0"`
}
2024-08-04 01:14:59 +07:00
type DiscoverySearchByID struct {
ID int64 `form:"id" json:"id" example:"0"`
}
2024-08-03 20:01:25 +07:00
func (d *DiscoveryHomeParam) ToEntity() *entity.DiscoverySearch {
if d.Limit == 0 {
d.Limit = 10
}
return &entity.DiscoverySearch{
Lat: d.Lat,
Long: d.Long,
Name: d.Name,
Region: d.Region,
Radius: d.Radius,
Limit: d.Limit,
Offset: d.Offset,
Discover: d.Discover,
}
}