qudoco-be/app/module/hero_section_image/service/hero_section_image.service.go

35 lines
938 B
Go
Raw Normal View History

2026-04-07 11:09:20 +00:00
package service
import (
"context"
"web-qudo-be/app/module/hero_section_image/repository"
)
type HeroSectionImageService struct {
Repo *repository.HeroSectionImageRepository
}
func NewHeroSectionImageService(repo *repository.HeroSectionImageRepository) *HeroSectionImageService {
return &HeroSectionImageService{Repo: repo}
}
// GET by hero_id
func (s *HeroSectionImageService) GetByHeroID(ctx context.Context, heroId int) (interface{}, error) {
return s.Repo.FindByHeroID(ctx, heroId)
}
// CREATE (UPLOAD)
func (s *HeroSectionImageService) Upload(ctx context.Context, heroId int, path, url string) error {
return s.Repo.Create(ctx, heroId, path, url)
}
// UPDATE
func (s *HeroSectionImageService) Update(ctx context.Context, id int, path, url string) error {
return s.Repo.Update(ctx, id, path, url)
}
// DELETE
func (s *HeroSectionImageService) Delete(ctx context.Context, id int) error {
return s.Repo.Delete(ctx, id)
}