feat: update route ads

This commit is contained in:
ericprd
2025-03-13 12:00:26 +08:00
parent 47085ca0ae
commit 1297c71200
6 changed files with 135 additions and 0 deletions
+1
View File
@@ -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
}
+19
View File
@@ -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)
}