feat (encounter): create and checkout + checking soapi done
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
package authhelper
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func GetAuthInfo(r *http.Request) (*AuthInfo, error) {
|
||||
ctxVal := r.Context().Value(AuthKey{})
|
||||
if ctxVal == nil {
|
||||
return nil, errors.New("can't get auth info")
|
||||
}
|
||||
authInfo := ctxVal.(*AuthInfo)
|
||||
return authInfo, nil
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package authhelper
|
||||
|
||||
import (
|
||||
ero "simrs-vx/internal/domain/references/organization"
|
||||
)
|
||||
|
||||
type AuthKey struct{}
|
||||
|
||||
type AuthInfo struct {
|
||||
Uuid string
|
||||
User_Id uint
|
||||
User_Name string
|
||||
// User_Email string
|
||||
// User_Ref_Id int
|
||||
User_Position_Code string
|
||||
}
|
||||
|
||||
func (a AuthInfo) IsDoctor() bool {
|
||||
return a.User_Position_Code == string(ero.UPCDoc)
|
||||
}
|
||||
|
||||
func (a AuthInfo) IsNurse() bool {
|
||||
return a.User_Position_Code == string(ero.UPCNur)
|
||||
}
|
||||
|
||||
func (a AuthInfo) IsNutritionist() bool {
|
||||
return a.User_Position_Code == string(ero.UPCNut)
|
||||
}
|
||||
|
||||
func (a AuthInfo) IsLaborant() bool {
|
||||
return a.User_Position_Code == string(ero.UPCLab)
|
||||
}
|
||||
|
||||
func (a AuthInfo) IsPharmacist() bool {
|
||||
return a.User_Position_Code == string(ero.UPCPha)
|
||||
}
|
||||
|
||||
func (a AuthInfo) IsPayment() bool {
|
||||
return a.User_Position_Code == string(ero.UPCPay)
|
||||
}
|
||||
|
||||
func (a AuthInfo) IsPaymentVerificator() bool {
|
||||
return a.User_Position_Code == string(ero.UPCPav)
|
||||
}
|
||||
|
||||
func (a AuthInfo) IsManagement() bool {
|
||||
return a.User_Position_Code == string(ero.UPCMan)
|
||||
}
|
||||
|
||||
func (a AuthInfo) IsSpecialistIntern() bool {
|
||||
return a.User_Position_Code == string(ero.UPCInt)
|
||||
}
|
||||
Reference in New Issue
Block a user