experiment: successfully implemented dependency injections for controllers and services
This commit is contained in:
@@ -2,7 +2,6 @@ package services
|
||||
|
||||
import (
|
||||
"easywish/internal/database"
|
||||
"easywish/internal/errors"
|
||||
errs "easywish/internal/errors"
|
||||
"easywish/internal/models"
|
||||
"easywish/internal/utils"
|
||||
@@ -23,32 +22,11 @@ func NewAuthService() AuthService {
|
||||
}
|
||||
|
||||
func (a *authServiceImpl) RegistrationBegin(request models.RegistrationBeginRequest) (bool, error) {
|
||||
conn, ctx, err := utils.GetDbConn()
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
defer conn.Close(ctx)
|
||||
|
||||
queries := database.New(conn)
|
||||
|
||||
tx, err := database.Begin()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer tx.Rollback()
|
||||
qtx := queries.WithTx(tx)
|
||||
|
||||
tx.Commit()
|
||||
|
||||
return
|
||||
return false, errs.ErrNotImplemented
|
||||
}
|
||||
|
||||
func (a *authServiceImpl) RegistrationComplete(request models.RegistrationBeginRequest) (*models.RegistrationCompleteResponse, error) {
|
||||
conn, ctx, err := utils.GetDbConn()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer conn.Close(ctx)
|
||||
return nil, errs.ErrNotImplemented
|
||||
}
|
||||
|
||||
func (a *authServiceImpl) Login(request models.LoginRequest) (*models.LoginResponse, error) {
|
||||
@@ -75,5 +53,5 @@ func (a *authServiceImpl) Login(request models.LoginRequest) (*models.LoginRespo
|
||||
}
|
||||
|
||||
func (a *authServiceImpl) Refresh(request models.RefreshRequest) (*models.RefreshResponse, error) {
|
||||
return nil, errors.ErrNotImplemented
|
||||
return nil, errs.ErrNotImplemented
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user