Skip to content

Commit

Permalink
Merge pull request #109 from Kos-Kita/totalbookingpermonth
Browse files Browse the repository at this point in the history
updte webhok
  • Loading branch information
lendral3n authored Feb 14, 2024
2 parents 55718d0 + 431bceb commit a4019f5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 43 deletions.
32 changes: 8 additions & 24 deletions features/booking/data/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
21 changes: 2 additions & 19 deletions features/booking/entity.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -25,30 +23,15 @@ type BookingCore struct {
BookingTotal float64
Status string
CreatedAt time.Time
UpdatedAt time.Time
ExpiredAt time.Time
PaidAt time.Time
// Payment PaymentCore
}

type MonthCount struct {
Month int
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
Expand Down

0 comments on commit a4019f5

Please sign in to comment.