monorepo/cloud/maplepress-backend/internal/domain/user/repository.go

29 lines
1.1 KiB
Go

package user
import "context"
// Repository defines the interface for user data access
// All methods require tenantID for multi-tenant isolation
type Repository interface {
// Create creates a new user
Create(ctx context.Context, tenantID string, user *User) error
// GetByID retrieves a user by ID
GetByID(ctx context.Context, tenantID string, id string) (*User, error)
// GetByEmail retrieves a user by email within a specific tenant
GetByEmail(ctx context.Context, tenantID string, email string) (*User, error)
// GetByEmailGlobal retrieves a user by email across all tenants (for login)
// This should only be used for authentication where tenant is not yet known
GetByEmailGlobal(ctx context.Context, email string) (*User, error)
// Update updates an existing user
Update(ctx context.Context, tenantID string, user *User) error
// Delete deletes a user by ID
Delete(ctx context.Context, tenantID string, id string) error
// ListByDate lists users created within a date range
ListByDate(ctx context.Context, tenantID string, startDate, endDate string, limit int) ([]*User, error)
}