2026-03-02 17:29:43 +03:00
|
|
|
package user
|
|
|
|
|
|
|
|
|
|
import (
|
2026-03-04 17:02:11 +03:00
|
|
|
"context"
|
2026-03-02 17:29:43 +03:00
|
|
|
"errors"
|
|
|
|
|
"merch-api/pkg/utils"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type service struct {
|
|
|
|
|
repo Repository
|
|
|
|
|
utils utils.Utils
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func newService(repo Repository, utils utils.Utils) *service {
|
|
|
|
|
return &service{
|
|
|
|
|
repo: repo,
|
|
|
|
|
utils: utils,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-06 19:07:33 +03:00
|
|
|
func (s *service) GetUserId(ctx context.Context, userUuid string) (int64, error) {
|
2026-03-02 17:29:43 +03:00
|
|
|
if userUuid == "" {
|
2026-03-06 19:07:33 +03:00
|
|
|
return 0, errors.New("user uuid is empty")
|
2026-03-02 17:29:43 +03:00
|
|
|
}
|
|
|
|
|
|
2026-03-04 17:02:11 +03:00
|
|
|
return s.repo.getUserId(ctx, userUuid)
|
2026-03-02 17:29:43 +03:00
|
|
|
}
|