fix: update user plan and rearrange structur project
This commit is contained in:
@@ -1,28 +1,18 @@
|
||||
package subscribedomain
|
||||
|
||||
import (
|
||||
subscribeplandm "legalgo-BE-go/internal/domain/subscribe_plan_model"
|
||||
subscribeplan "legalgo-BE-go/internal/domain/subscribe_plan"
|
||||
"time"
|
||||
)
|
||||
|
||||
type SubscribeDepecrate struct {
|
||||
ID string `json:"id"`
|
||||
SubscribePlanID string `json:"subscribe_plan_id"`
|
||||
}
|
||||
|
||||
type SubscribeUpdateReqDepecrate struct {
|
||||
ID string `json:"id"`
|
||||
Status string `json:"status"`
|
||||
}
|
||||
|
||||
// refactored
|
||||
type Subscribe struct {
|
||||
ID string `gorm:"primaryKey" json:"id"`
|
||||
SubscribePlanID string `gorm:"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"`
|
||||
ID string `json:"id"`
|
||||
SubscribePlanID string `json:"subscribe_plan_id"`
|
||||
StartDate time.Time `json:"start_date"`
|
||||
EndDate *time.Time `json:"end_date"`
|
||||
Status string `json:"status"`
|
||||
AutoRenew bool `json:"auto_renew"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
|
||||
SubscribePlan subscribeplandm.SubscribePlan `gorm:"foreignKey:SubscribePlanID;constraint:OnDelete:CASCADE" json:"subscribe_plan"`
|
||||
SubscribePlan subscribeplan.SubscribePlan `gorm:"foreignKey:SubscribePlanID" json:"subscribe_plan"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user