feat (crud): add installation, unit
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
e "simrs-vx/internal/domain/main-entities/user"
|
||||
"strconv"
|
||||
@@ -213,14 +214,20 @@ func ReadDetail(input e.ReadDetailDto) (*d.Data, error) {
|
||||
|
||||
pl.SetLogInfo(&event, input, "started", "DBReadDetail")
|
||||
data, err = ReadDetailData(input, tx)
|
||||
if err != nil {
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
event.Status = "failed"
|
||||
event.ErrInfo = pl.ErrorInfo{
|
||||
Code: "data-notFound",
|
||||
Detail: fmt.Sprintf("Data with ID %v not found", input.Id),
|
||||
Raw: err,
|
||||
}
|
||||
} else {
|
||||
event.Status = "failed"
|
||||
event.ErrInfo = pl.ErrorInfo{
|
||||
Code: "data-read-detail-fail",
|
||||
Detail: "Database read detail failed",
|
||||
Raw: err,
|
||||
}
|
||||
return pl.SetLogError(event, input)
|
||||
}
|
||||
|
||||
pl.SetLogInfo(&event, nil, "complete")
|
||||
|
||||
Reference in New Issue
Block a user