feat: migrate auth module to modular domain pattern

This commit is contained in:
2026-05-13 10:31:46 +02:00
parent afdd880d0e
commit 34aeb91252
6 changed files with 232 additions and 0 deletions

23
internal/domain/auth.go Normal file
View File

@@ -0,0 +1,23 @@
package domain
import (
"context"
"mal/internal/db"
)
type User = db.User
type Session = db.Session
type AuthService interface {
Login(ctx context.Context, username, password string) (*Session, error)
ValidateSession(ctx context.Context, sessionID string) (*User, error)
Logout(ctx context.Context, sessionID string) error
}
type AuthRepository interface {
GetUserByUsername(ctx context.Context, username string) (*User, error)
GetUserByID(ctx context.Context, id string) (*User, error)
CreateSession(ctx context.Context, userID string, sessionID string) (*Session, error)
GetSession(ctx context.Context, sessionID string) (*Session, error)
DeleteSession(ctx context.Context, sessionID string) error
}