feat (consultation): add guard for diff doctor_id

This commit is contained in:
dpurbosakti
2025-09-24 14:32:31 +07:00
parent e7c6264e27
commit ea50df44bd
2 changed files with 11 additions and 0 deletions
+1
View File
@@ -39,6 +39,7 @@
"data-state-mismatch": "\"%v\" is not in \"%v\" state",
"data-duplicate": "duplicate data",
"data-payment-fail": "failed to create payment",
"data-handled-mismatch": "data handled by different user/person",
"expired": "is expired",
"registered": "is already registered",
@@ -321,6 +321,16 @@ func Reply(input e.ReplyDto) (*d.Data, error) {
return err
}
if data.Doctor_Id != nil && data.Doctor_Id != doctor_id {
event.Status = "failed"
event.ErrInfo = pl.ErrorInfo{
Code: "data-handled-mismatch",
Detail: "data handled by different user/person",
Raw: errors.New("data handled by different user/person"),
}
return pl.SetLogError(&event, input)
}
data.Doctor_Id = doctor_id
data.Solution = input.Solution
data.RepliedAt = pu.GetTimeNow()