This commit is contained in:
dpurbosakti
2025-09-04 21:15:11 +07:00
parent 56d9513dd7
commit dd409e5c5e
11 changed files with 59 additions and 20 deletions

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
}