Add Checkin
This commit is contained in:
@@ -47,6 +47,14 @@ type OrderParam struct {
|
||||
Source string `form:"source" json:"source" example:"tes"`
|
||||
}
|
||||
|
||||
type Checkin struct {
|
||||
QRCode string `json:"qr_code" validate:"required"`
|
||||
}
|
||||
|
||||
type CheckinExecute struct {
|
||||
Token string `json:"token" validate:"required"`
|
||||
}
|
||||
|
||||
func (o *OrderParam) ToOrderEntity(ctx mycontext.Context) entity.OrderSearch {
|
||||
return entity.OrderSearch{
|
||||
PartnerID: ctx.GetPartnerID(),
|
||||
|
||||
@@ -3,6 +3,9 @@ package request
|
||||
import (
|
||||
"furtuna-be/internal/common/mycontext"
|
||||
"furtuna-be/internal/entity"
|
||||
"log"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Site struct {
|
||||
@@ -21,6 +24,9 @@ type Site struct {
|
||||
IsSeasonTicket bool `json:"is_season_ticket"`
|
||||
IsDiscountActive bool `json:"is_discount_active"`
|
||||
Products []Product `json:"products"`
|
||||
Region string `json:"region"`
|
||||
Regency string `json:"regency"`
|
||||
LatLong string `json:"lat_long"`
|
||||
}
|
||||
|
||||
func (r *Site) ToEntity(createdBy int64) *entity.Site {
|
||||
@@ -39,6 +45,17 @@ func (r *Site) ToEntity(createdBy int64) *entity.Site {
|
||||
CreatedBy: createdBy,
|
||||
})
|
||||
}
|
||||
latLong := strings.Split(r.LatLong, ".")
|
||||
|
||||
lat, err := strconv.ParseFloat(latLong[0], 64)
|
||||
if err != nil {
|
||||
log.Fatalf("Error converting latitude: %v", err)
|
||||
}
|
||||
|
||||
long, err := strconv.ParseFloat(latLong[1], 64)
|
||||
if err != nil {
|
||||
log.Fatalf("Error converting longitude: %v", err)
|
||||
}
|
||||
|
||||
return &entity.Site{
|
||||
ID: r.ID,
|
||||
@@ -56,6 +73,10 @@ func (r *Site) ToEntity(createdBy int64) *entity.Site {
|
||||
IsSeasonTicket: r.IsSeasonTicket,
|
||||
IsDiscountActive: r.IsDiscountActive,
|
||||
Products: products,
|
||||
Region: r.Region,
|
||||
Regency: r.Regency,
|
||||
Lat: lat,
|
||||
Long: long,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user