29 lines
978 B
Go
29 lines
978 B
Go
package subsmodel
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
type Subscribe struct {
|
|
ID uuid.UUID `gorm:"type:uuid;primaryKey" json:"id"`
|
|
SubscribePlanID uuid.UUID `gorm:"type:uuid;not null" json:"subscribe_plan_id"`
|
|
StartDate time.Time `gorm:"default:CURRENT_TIMESTAMP"`
|
|
EndDate time.Time `gorm:"default:null"`
|
|
Status string `gorm:"default:'inactive'"`
|
|
AutoRenew bool `gorm:"default:true"`
|
|
CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP"`
|
|
UpdatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP"`
|
|
|
|
SubscribePlan SubscribePlan `gorm:"foreignKey:SubscribePlanID;constraint:OnDelete:CASCADE"`
|
|
}
|
|
|
|
type SubscribePlan struct {
|
|
ID uuid.UUID `gorm:"type:uuid;primaryKey" json:"id"`
|
|
Code string `gorm:"not null" json:"code"`
|
|
Name string `gorm:"not null" json:"name"`
|
|
CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP"`
|
|
UpdatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP"`
|
|
}
|