feat(kol): add avatar upload to KolProfileService

This commit is contained in:
2026-04-18 14:05:09 +08:00
parent 0e3515530f
commit 1393b25419
2 changed files with 118 additions and 1 deletions
@@ -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 {