Documentation ¶
Overview ¶
Package service provides a set of functions to handle the application's business logic.
These functions are designed to be called directly by request controllers, allowing the controllers to remain simple and focused on handling HTTP requests and responses. By offloading complex business logic and database requests to the respective service functions, the application becomes more modular, easier to maintain, and less prone to errors.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthService ¶
type AuthService interface { Authenticate(ctx context.Context, user *model.User) error Create(ctx context.Context, user *model.User) error Logout(ctx context.Context, user *model.User) error LogoutAll(ctx context.Context, user *model.User) error Exists(ctx context.Context, user *model.User) bool // FIXME remove and combine into single transaction with Create Fetch(ctx context.Context, user *model.User) error }
AuthService is an interface for authentication related operations.
func NewAuthService ¶
func NewAuthService( userRepository repository.UserRepository, eventRepository repository.EventRepository, ) AuthService
NewAuthService creates a new AuthService with the given user + event repositories.
type SessionService ¶
type SessionService interface { Create(ctx context.Context, userID uuid.UUID) (*http.Cookie, error) Extend(ctx context.Context, userID string, cookie *http.Cookie) (*http.Cookie, error) Fetch(ctx context.Context, sessionID string) (uuid.UUID, error) FetchAll(ctx context.Context, sessionID string) ([]string, error) Remove(ctx context.Context, cookie *http.Cookie) (*http.Cookie, error) RemoveAll(ctx context.Context, cookie *http.Cookie) (*http.Cookie, error) }
SessionService is an interface for session/Redis related operations.
func NewSessionService ¶
func NewSessionService(sessionCache cache.SessionCache) SessionService
NewSessionService creates a new SessionService with the given session cache.