This commit is contained in:
vanilia
2025-11-11 15:35:19 +07:00
parent a382dfdb3e
commit 733fb481b3
6 changed files with 49 additions and 24 deletions

No files matched your search

@@ -42,8 +42,15 @@ func Create(input e.CreateDto) (*d.Data, error) {
return err
}
if !eru.IsValidUploadCode(input.EntityType_Code, input.Type_Code) {
return errors.New("invalid upload code")
valid, msg := eru.IsValidUploadCode(input.EntityType_Code, input.Type_Code)
if !valid {
event.Status = "failed"
event.ErrInfo = pl.ErrorInfo{
Code: "invalid-code",
Detail: msg,
Raw: errors.New(msg),
}
return pl.SetLogError(&event, input)
}
input.FilePath, err = uploadAndGenerateFileUrl(input, &event)
@@ -238,8 +245,15 @@ func Update(input e.UpdateDto) (*d.Data, error) {
return err
}
if !eru.IsValidUploadCode(input.EntityType_Code, input.Type_Code) {
return errors.New("invalid upload code")
valid, msg := eru.IsValidUploadCode(input.EntityType_Code, input.Type_Code)
if !valid {
event.Status = "failed"
event.ErrInfo = pl.ErrorInfo{
Code: "invalid-code",
Detail: msg,
Raw: errors.New(msg),
}
return pl.SetLogError(&event, input)
}
if data, err = ReadDetailData(rdDto, &event, tx); err != nil {