feat/authentication

+ moved pkg/auth-helper to internal/lib/auth
+ update AuthInfo
+ cleaning
This commit is contained in:
2025-10-26 21:29:41 +07:00
parent b5b0a8183d
commit 2c432a7bef
33 changed files with 227 additions and 121 deletions
@@ -12,7 +12,7 @@ import (
u "simrs-vx/internal/use-case/main-use-case/encounter"
erc "simrs-vx/internal/domain/references/common"
pa "simrs-vx/pkg/auth-helper"
pa "simrs-vx/internal/lib/auth"
d "github.com/karincake/dodol"
)
@@ -36,7 +36,12 @@ func (obj myBase) Create(w http.ResponseWriter, r *http.Request) {
}
func (obj myBase) GetList(w http.ResponseWriter, r *http.Request) {
authInfo, err := pa.GetAuthInfo(r)
if err != nil {
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
}
dto := e.ReadListDto{}
dto.AuthInfo = *authInfo
sf.UrlQueryParam(&dto, *r.URL)
res, err := u.ReadList(dto)
rw.DataResponse(w, res, err)