28 lines
905 B
Go
28 lines
905 B
Go
package port
|
|
|
|
import (
|
|
"context"
|
|
|
|
"git.threesix.ai/jordan/slack-auth-1770277926/services/auth-api/internal/domain"
|
|
)
|
|
|
|
// UserRepository defines the interface for user persistence operations.
|
|
// Implementations may use databases, in-memory storage, or external services.
|
|
type UserRepository interface {
|
|
// Get returns a user by ID.
|
|
// Returns domain.ErrUserNotFound if not found.
|
|
Get(ctx context.Context, id domain.UserID) (*domain.User, error)
|
|
|
|
// GetByEmail returns a user by email address.
|
|
// Returns domain.ErrUserNotFound if not found.
|
|
GetByEmail(ctx context.Context, email string) (*domain.User, error)
|
|
|
|
// Create stores a new user.
|
|
// The user must have a valid ID set.
|
|
Create(ctx context.Context, user *domain.User) error
|
|
|
|
// ExistsByEmail checks if a user with the given email exists.
|
|
// Used for duplicate detection.
|
|
ExistsByEmail(ctx context.Context, email string) (bool, error)
|
|
}
|