refactor
This commit is contained in:
No files matched your search
@@ -5,6 +5,7 @@ Any functions that are used internally by the use-case
|
||||
package user
|
||||
|
||||
import (
|
||||
"errors"
|
||||
ee "simrs-vx/internal/domain/main-entities/employee"
|
||||
esi "simrs-vx/internal/domain/main-entities/specialist-intern"
|
||||
e "simrs-vx/internal/domain/main-entities/user"
|
||||
@@ -56,18 +57,20 @@ func setDataEmployeeUpdate(src e.EmployeUpdateDto) ee.UpdateDto {
|
||||
func getPersonIdByUserId(userId uint, positionCode ero.UserPosisitionCode, event *pl.Event, tx *gorm.DB) (*uint, error) {
|
||||
pl.SetLogInfo(event, nil, "started", "DBGetPersonIdByUserId")
|
||||
if positionCode == ero.UPCInt {
|
||||
person, err := usi.ReadDetailData(esi.ReadDetailDto{User_Id: &userId}, event, tx)
|
||||
specInt, err := usi.ReadDetailData(esi.ReadDetailDto{User_Id: &userId}, event, tx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &person.Id, nil
|
||||
if specInt.Person_Id == nil {
|
||||
return nil, errors.New("person id not found")
|
||||
}
|
||||
return specInt.Person_Id, nil
|
||||
}
|
||||
|
||||
person, err := ue.ReadDetailData(ee.ReadDetailDto{User_Id: &userId}, event, tx)
|
||||
emp, err := ue.ReadDetailData(ee.ReadDetailDto{User_Id: &userId}, event, tx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &person.Id, nil
|
||||
return emp.Person_Id, nil
|
||||
}
|
||||
Reference in New Issue
Block a user