27 lines
1.4 KiB
Go
27 lines
1.4 KiB
Go
|
|
package entity
|
||
|
|
|
||
|
|
import (
|
||
|
|
users "narasi-ahli-be/app/database/entity/users"
|
||
|
|
"time"
|
||
|
|
)
|
||
|
|
|
||
|
|
type EbookPurchases struct {
|
||
|
|
ID uint `json:"id" gorm:"primaryKey;type:int4;autoIncrement"`
|
||
|
|
BuyerId uint `json:"buyer_id" gorm:"type:int4"`
|
||
|
|
Buyer *users.Users `json:"buyer" gorm:"foreignKey:BuyerId;references:ID"`
|
||
|
|
EbookId uint `json:"ebook_id" gorm:"type:int4"`
|
||
|
|
Ebook *Ebooks `json:"ebook" gorm:"foreignKey:EbookId;references:ID"`
|
||
|
|
PurchasePrice float64 `json:"purchase_price" gorm:"type:decimal(10,2)"`
|
||
|
|
PaymentMethod *string `json:"payment_method" gorm:"type:varchar"`
|
||
|
|
PaymentStatus *string `json:"payment_status" gorm:"type:varchar;default:'pending'"`
|
||
|
|
TransactionId *string `json:"transaction_id" gorm:"type:varchar"`
|
||
|
|
PaymentProof *string `json:"payment_proof" gorm:"type:varchar"`
|
||
|
|
PaymentDate *time.Time `json:"payment_date" gorm:"type:timestamp"`
|
||
|
|
DownloadCount *int `json:"download_count" gorm:"type:int4;default:0"`
|
||
|
|
LastDownloadAt *time.Time `json:"last_download_at" gorm:"type:timestamp"`
|
||
|
|
StatusId *int `json:"status_id" gorm:"type:int4;default:1"`
|
||
|
|
IsActive *bool `json:"is_active" gorm:"type:bool;default:true"`
|
||
|
|
CreatedAt time.Time `json:"created_at" gorm:"default:now()"`
|
||
|
|
UpdatedAt time.Time `json:"updated_at" gorm:"default:now()"`
|
||
|
|
}
|