feat (item): fix get-detail by code

This commit is contained in:
dpurbosakti
2025-12-05 14:18:39 +07:00
parent 6e9c57226c
commit 6c13b1ad51
2 changed files with 10 additions and 2 deletions

No files matched your search

+9 -1
View File
@@ -81,7 +81,15 @@ func ReadDetailData(input e.ReadDetailDto, event *pl.Event, dbx ...*gorm.DB) (*e
tx = dg.I
}
if err := tx.First(&data, input.Id).Error; err != nil {
if input.Code != nil {
tx = tx.Where("\"Code\" = ?", *input.Code)
}
if input.Id != nil {
tx = tx.Where("\"Id\" = ?", input.Id)
}
if err := tx.First(&data).Error; err != nil {
if processedErr := pu.HandleReadError(err, event, source, input.Id, data); processedErr != nil {
return nil, processedErr
}