mirror of
https://github.com/rishikanthc/Scriberr.git
synced 2026-06-30 07:46:16 +00:00
Phase 1: Define interfaces - Created internal/interfaces/ package with AuthServiceInterface, TaskQueueInterface, JobProcessorInterface Phase 2: Refactor handlers.go (21 DB calls removed) - Replaced all database.DB calls with repository methods - Added RefreshTokenRepository for token management - Added new repository methods: Count, FindActiveTrackJobs, FindLatestCompletedExecution, FindByName Phase 3: Refactor dropzone.go (3 DB calls removed) - Added CountWithAutoTranscription to UserRepository - Injected JobRepository and UserRepository into Service Phase 4: Refactor multitrack_processor.go - Changed constructor to accept *gorm.DB and JobRepository - Updated Handler to inject MultiTrackProcessor Updated all test files with new dependencies and mock implementations.
20 lines
646 B
Go
20 lines
646 B
Go
package interfaces
|
|
|
|
import (
|
|
"scriberr/internal/auth"
|
|
"scriberr/internal/models"
|
|
)
|
|
|
|
// AuthServiceInterface defines the contract for authentication services.
|
|
// This allows handlers to depend on an interface rather than a concrete type.
|
|
type AuthServiceInterface interface {
|
|
// GenerateToken generates a JWT token for a user (24h expiry)
|
|
GenerateToken(user *models.User) (string, error)
|
|
|
|
// GenerateLongLivedToken generates a JWT token for a user (1 year expiry)
|
|
GenerateLongLivedToken(user *models.User) (string, error)
|
|
|
|
// ValidateToken validates a JWT token and returns claims
|
|
ValidateToken(tokenString string) (*auth.Claims, error)
|
|
}
|