feat: update route ads
This commit is contained in:
@@ -12,6 +12,7 @@ type impl struct {
|
||||
type Ads interface {
|
||||
Create(adsdomain.AdsReq) error
|
||||
GetAll() ([]adsdomain.Ads, error)
|
||||
Update(string, adsdomain.AdsReq) error
|
||||
Delete(string) error
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package adssvc
|
||||
|
||||
import (
|
||||
adsdomain "legalgo-BE-go/internal/domain/ads"
|
||||
timeutils "legalgo-BE-go/internal/utilities/time_utils"
|
||||
)
|
||||
|
||||
func (i *impl) Update(adsID string, spec adsdomain.AdsReq) error {
|
||||
newsSpec := adsdomain.Ads{
|
||||
ID: adsID,
|
||||
ImageUrl: spec.Image,
|
||||
Url: spec.URL,
|
||||
UpdatedAt: timeutils.Now(),
|
||||
StartDate: spec.StartDate,
|
||||
EndDate: spec.EndDate,
|
||||
}
|
||||
|
||||
return i.adsRepo.Update(newsSpec)
|
||||
}
|
||||
Reference in New Issue
Block a user