From 431bceb22eb6f7d0ff11956c9f1449c9b93cdab9 Mon Sep 17 00:00:00 2001 From: lendral3n Date: Wed, 14 Feb 2024 14:01:44 +0700 Subject: [PATCH] updte webhok --- features/booking/data/model.go | 32 ++++++++------------------------ features/booking/entity.go | 21 ++------------------- 2 files changed, 10 insertions(+), 43 deletions(-) diff --git a/features/booking/data/model.go b/features/booking/data/model.go index 887f262..9eec58c 100644 --- a/features/booking/data/model.go +++ b/features/booking/data/model.go @@ -10,39 +10,23 @@ import ( ) type Booking struct { - Code string `gorm:"type:varchar(36);primary_key" json:"id"` - Total float64 + Code string `gorm:"type:varchar(36);primary_key" json:"id"` + Total float64 UserId uint BoardingHouseId uint - Status string + Status string BookedAt time.Time `gorm:"autoCreateTime"` DeletedAt gorm.DeletedAt `gorm:"index"` - CreatedAt time.Time `gorm:"index"` + CreatedAt time.Time `gorm:"index"` User ud.User `gorm:"foreignKey:UserId"` BoardingHouse kd.BoardingHouse `gorm:"foreignKey:BoardingHouseId"` Method string `gorm:"column:method; type:varchar(20);"` - Bank string - VirtualNumber string `gorm:"column:virtual_number; type:varchar(50);"` - ExpiredAt time.Time - // Payment Payment `gorm:"embedded;embeddedPrefix:payment_"` + Bank string + VirtualNumber string `gorm:"column:virtual_number; type:varchar(50);"` + ExpiredAt time.Time + UpdatedAt time.Time } -// type Payment struct { -// Method string `gorm:"column:method; type:varchar(20);"` -// Bank string `gorm:"column:bank; type:varchar(20);"` -// VirtualNumber string `gorm:"column:virtual_number; type:varchar(50);"` -// BillKey string `gorm:"column:bill_key; type:varchar(50);"` -// BillCode string `gorm:"column:bill_code; type:varchar(50);"` -// CreatedAt time.Time `gorm:"index"` -// ExpiredAt *time.Time `gorm:"nullable"` -// PaidAt *time.Time `gorm:"default:null;"` -// } - -// type MonthCount struct { -// Month int -// Count int -// } - func CoreToModelBook(input booking.BookingCore) Booking { return Booking{ Code: input.Code, diff --git a/features/booking/entity.go b/features/booking/entity.go index fdc5bc2..d13a37a 100644 --- a/features/booking/entity.go +++ b/features/booking/entity.go @@ -5,15 +5,13 @@ import ( kd "KosKita/features/kos" ud "KosKita/features/user" - - "gorm.io/gorm" ) type BookingCore struct { Code string Total float64 BookedAt time.Time - DeletedAt gorm.DeletedAt + DeletedAt time.Time UserId uint User ud.Core BoardingHouseId uint @@ -25,9 +23,8 @@ type BookingCore struct { BookingTotal float64 Status string CreatedAt time.Time + UpdatedAt time.Time ExpiredAt time.Time - PaidAt time.Time - // Payment PaymentCore } type MonthCount struct { @@ -35,20 +32,6 @@ type MonthCount struct { Count int } -// type PaymentCore struct { -// Method string -// Bank string -// VirtualNumber string -// BillKey string -// BillCode string -// BookingCode int -// BookingTotal float64 -// Status string -// CreatedAt time.Time -// ExpiredAt time.Time -// PaidAt time.Time -// } - type BookDataInterface interface { Insert(userIdLogin int, input BookingCore) (*BookingCore, error) CancelBooking(userIdLogin int, bookingId string, bookingCore BookingCore) error