Multiple implementations of the same back-end application. The aim is to provide quick, side-by-side comparisons of different technologies (languages, frameworks, libraries) while preserving consistent business logic across all implementations.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

35 lines
836 B

package commands
import (
"context"
"autostore/internal/application/interfaces"
)
type LoginUserCommand struct {
authService interfaces.IAuthService
logger interfaces.ILogger
}
func NewLoginUserCommand(
authService interfaces.IAuthService,
logger interfaces.ILogger,
) *LoginUserCommand {
return &LoginUserCommand{
authService: authService,
logger: logger,
}
}
func (c *LoginUserCommand) Execute(ctx context.Context, username string, password string) (string, error) {
c.logger.Info(ctx, "Executing login command", "username", username)
token, err := c.authService.Authenticate(ctx, username, password)
if err != nil {
c.logger.Warn(ctx, "Authentication failed", "username", username, "error", err)
return "", err
}
c.logger.Info(ctx, "Login successful", "username", username)
return token, nil
}