feat(kol): add avatar upload to KolProfileService
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/geo-platform/tenant-api/internal/shared/auth"
|
||||
"github.com/geo-platform/tenant-api/internal/shared/objectstorage"
|
||||
"github.com/geo-platform/tenant-api/internal/shared/response"
|
||||
"github.com/geo-platform/tenant-api/internal/tenant/repository"
|
||||
)
|
||||
@@ -12,7 +13,8 @@ import (
|
||||
var ErrNotActiveKol = response.ErrForbidden(40341, "kol_not_active", "user is not an active KOL")
|
||||
|
||||
type KolProfileService struct {
|
||||
repo repository.KolProfileRepository
|
||||
repo repository.KolProfileRepository
|
||||
objectStorage objectstorage.Client
|
||||
}
|
||||
|
||||
type UpdateKolProfileServiceInput struct {
|
||||
@@ -38,6 +40,11 @@ func NewKolProfileService(repo repository.KolProfileRepository) *KolProfileServi
|
||||
return &KolProfileService{repo: repo}
|
||||
}
|
||||
|
||||
func (s *KolProfileService) WithObjectStorage(client objectstorage.Client) *KolProfileService {
|
||||
s.objectStorage = client
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *KolProfileService) RequireActiveKol(ctx context.Context, actor auth.Actor) (*repository.KolProfile, error) {
|
||||
profile, err := s.repo.GetByUser(ctx, actor.TenantID, actor.UserID)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user