fix: add start date and end date of ads
This commit is contained in:
parent
ce17e9dc73
commit
47085ca0ae
@ -6,6 +6,8 @@ type Ads struct {
|
|||||||
ID string `gorm:"primaryKey;not null" json:"id"`
|
ID string `gorm:"primaryKey;not null" json:"id"`
|
||||||
ImageUrl string `gorm:"not null" json:"image_url"`
|
ImageUrl string `gorm:"not null" json:"image_url"`
|
||||||
Url string `gorm:"not null" json:"url"`
|
Url string `gorm:"not null" json:"url"`
|
||||||
|
StartDate *time.Time `gorm:"default:null" json:"start_date"`
|
||||||
|
EndDate *time.Time `gorm:"default:null" json:"end_date"`
|
||||||
CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_at"`
|
CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_at"`
|
||||||
UpdatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"updated_at"`
|
UpdatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"updated_at"`
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,14 +5,18 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Ads struct {
|
type Ads struct {
|
||||||
ID string `gorm:"primaryKey;not null" json:"id"`
|
ID string `json:"id"`
|
||||||
ImageUrl string `gorm:"not null" json:"image_url"`
|
ImageUrl string `json:"image_url"`
|
||||||
Url string `gorm:"not null" json:"url"`
|
Url string `json:"url"`
|
||||||
CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_at"`
|
StartDate *time.Time `json:"start_date"`
|
||||||
UpdatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"updated_at"`
|
EndDate *time.Time `json:"end_date"`
|
||||||
|
CreatedAt time.Time `json:"created_at"`
|
||||||
|
UpdatedAt time.Time `json:"updated_at"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type AdsReq struct {
|
type AdsReq struct {
|
||||||
Image string `json:"image" validate:"required"`
|
Image string `json:"image" validate:"required"`
|
||||||
URL string `json:"url" validate:"required"`
|
URL string `json:"url" validate:"required"`
|
||||||
|
StartDate *time.Time `json:"start_date" validate:"required"`
|
||||||
|
EndDate *time.Time `json:"end_date" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,6 +21,8 @@ func (i *impl) Create(spec adsdomain.AdsReq) error {
|
|||||||
ID: uuid.NewString(),
|
ID: uuid.NewString(),
|
||||||
ImageUrl: spec.Image,
|
ImageUrl: spec.Image,
|
||||||
Url: spec.URL,
|
Url: spec.URL,
|
||||||
|
StartDate: spec.StartDate,
|
||||||
|
EndDate: spec.EndDate,
|
||||||
}
|
}
|
||||||
|
|
||||||
return i.adsRepo.Create(newSpec)
|
return i.adsRepo.Create(newSpec)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user