chores: refactor struct and structure project

This commit is contained in:
ericprd
2025-03-05 21:21:44 +08:00
parent 13a8481f22
commit 567e0e32ca
103 changed files with 1125 additions and 731 deletions
+4 -4
View File
@@ -2,19 +2,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) GetStaffByID(ID string) (*authdomain.Staff, error) {
var staff authdomain.Staff
func (sr *impl) GetStaffByID(ID string) (*staffdomain.Staff, error) {
var staff staffdomain.Staff
if ID == "" {
return nil, errors.New("id is required")
}
if err := sr.DB.First(&staff, "id = ? ", ID).Error; err != nil {
if err := sr.db.First(&staff, "id = ? ", ID).Error; err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
return nil, errors.New("staff not found")
}