feat (consultation): add guard for diff doctor_id
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user