fix: handle duplicate input
This commit is contained in:
@@ -7,8 +7,8 @@ import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
func (sr *StaffRepository) GetStaffByEmail(email string) (*authdomain.LoginRepoResponse, error) {
|
||||
var staff authdomain.LoginRepoResponse
|
||||
func (sr *StaffRepository) GetStaffByEmail(email string) (*authdomain.Staff, error) {
|
||||
var staff authdomain.Staff
|
||||
|
||||
if email == "" {
|
||||
return nil, errors.New("email is empty")
|
||||
|
||||
@@ -10,7 +10,7 @@ type StaffRepository struct {
|
||||
}
|
||||
|
||||
type StaffIntf interface {
|
||||
GetStaffByEmail(string) (*authdomain.LoginRepoResponse, error)
|
||||
GetStaffByEmail(string) (*authdomain.Staff, error)
|
||||
Create(*authdomain.Staff) (*authdomain.Staff, error)
|
||||
}
|
||||
|
||||
|
||||
@@ -3,12 +3,12 @@ package userrepository
|
||||
import (
|
||||
"errors"
|
||||
|
||||
usermodel "github.com/ardeman/project-legalgo-go/database/user"
|
||||
authdomain "github.com/ardeman/project-legalgo-go/internal/domain/auth"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
func (ur *UserRepository) GetUserByEmail(email string) (*usermodel.User, error) {
|
||||
var user usermodel.User
|
||||
func (ur *UserRepository) GetUserByEmail(email string) (*authdomain.User, error) {
|
||||
var user authdomain.User
|
||||
|
||||
if email == "" {
|
||||
return nil, errors.New("email is empty")
|
||||
|
||||
@@ -2,7 +2,6 @@ package userrepository
|
||||
|
||||
import (
|
||||
"github.com/ardeman/project-legalgo-go/database"
|
||||
usermodel "github.com/ardeman/project-legalgo-go/database/user"
|
||||
authdomain "github.com/ardeman/project-legalgo-go/internal/domain/auth"
|
||||
)
|
||||
|
||||
@@ -11,7 +10,7 @@ type UserRepository struct {
|
||||
}
|
||||
|
||||
type UserIntf interface {
|
||||
GetUserByEmail(string) (*usermodel.User, error)
|
||||
GetUserByEmail(string) (*authdomain.User, error)
|
||||
CreateUser(*authdomain.User) (*authdomain.User, error)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user