chores: refactor struct and structure project
This commit is contained in:
@@ -3,19 +3,19 @@ package staffrepository
|
||||
import (
|
||||
"errors"
|
||||
|
||||
authdomain "legalgo-BE-go/internal/domain/auth"
|
||||
staffdomain "legalgo-BE-go/internal/domain/staff"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
func (sr *StaffRepository) GetStaffByEmail(email string) (*authdomain.Staff, error) {
|
||||
var staff authdomain.Staff
|
||||
func (sr *impl) GetStaffByEmail(email string) (*staffdomain.Staff, error) {
|
||||
var staff staffdomain.Staff
|
||||
|
||||
if email == "" {
|
||||
return nil, errors.New("email is required")
|
||||
}
|
||||
|
||||
if err := sr.DB.First(&staff, "email = ?", email).Error; err != nil {
|
||||
if err := sr.db.First(&staff, "email = ?", email).Error; err != nil {
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return nil, errors.New("staff not found")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user