spark-server/internal/module/user/logic/find.go
zhr ae9a71034d feat: implement Spark IM V3 modular monolith
Add HTTP /v1 MVC, TCP send path, groups with server-side member-avatar collage, object-storage upload, and friends/favorites around the architecture-v3 layout.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-17 19:52:11 +08:00

32 lines
707 B
Go

package logic
import (
"context"
"strings"
"spark-server/internal/module/user/entity"
"spark-server/internal/pkg/errs"
)
func (s *Service) GetByEmail(ctx context.Context, email string) (*entity.User, error) {
if s == nil || s.repo == nil {
return nil, errs.ErrNotFound
}
email = entity.NormalizeEmail(email)
if email == "" {
return nil, errs.ErrNotFound
}
return s.repo.GetByEmail(ctx, email)
}
func (s *Service) GetBySparkID(ctx context.Context, sparkID string) (*entity.User, error) {
if s == nil || s.repo == nil {
return nil, errs.ErrNotFound
}
sparkID = strings.TrimSpace(sparkID)
if sparkID == "" {
return nil, errs.ErrNotFound
}
return s.repo.GetBySparkID(ctx, sparkID)
}