25 lines
461 B
Go
25 lines
461 B
Go
package services
|
|
|
|
import (
|
|
"database/sql"
|
|
|
|
"go-backend/internal/auth"
|
|
)
|
|
|
|
type AuthService struct {
|
|
db *sql.DB
|
|
}
|
|
|
|
func NewAuthService(db *sql.DB) *AuthService {
|
|
return &AuthService{
|
|
db: db,
|
|
}
|
|
}
|
|
|
|
func (s *AuthService) CreateSession(userID string) (*auth.SessionWithToken, error) {
|
|
return auth.CreateSession(s.db, userID)
|
|
}
|
|
|
|
func (s *AuthService) ValidateSessionToken(token string) (*auth.Session, error) {
|
|
return auth.ValidateSessionToken(s.db, token)
|
|
}
|