encounter mapping
This commit is contained in:
No files matched your search
@@ -1,6 +1,7 @@
|
||||
package patient
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"strconv"
|
||||
|
||||
pl "simrs-vx/pkg/logger"
|
||||
@@ -38,6 +39,19 @@ func Create(input e.CreateDto) (*d.Data, error) {
|
||||
pl.SetLogInfo(&event, input, "started", "create")
|
||||
mwRunner := newMiddlewareRunner(&event)
|
||||
|
||||
// check if user has employee position
|
||||
if !input.AuthInfo.HasEmployeePosition() {
|
||||
event.Status = "failed"
|
||||
event.ErrInfo = pl.ErrorInfo{
|
||||
Code: "auth-forbidden",
|
||||
Detail: "user has no employee position",
|
||||
Raw: errors.New("authentication failed"),
|
||||
}
|
||||
return nil, pl.SetLogError(&event, input)
|
||||
}
|
||||
|
||||
input.RegisteredBy_User_Name = &input.AuthInfo.User_Name
|
||||
|
||||
err := dg.I.Transaction(func(tx *gorm.DB) error {
|
||||
mwRunner.setMwType(pu.MWTPre)
|
||||
// Run pre-middleware
|
||||
|
||||
Reference in New Issue
Block a user