From 7d7c9bd8a562629766f095c04402d62d99637eea Mon Sep 17 00:00:00 2001 From: Maksym Hrynenko Date: Fri, 13 Dec 2024 14:59:27 +0200 Subject: [PATCH] fix: var-naming linter error --- internal/data/pg/verify_users.go | 2 +- internal/data/verify_users.go | 2 +- internal/service/handlers/get_proof_parameters.go | 6 +++--- internal/service/handlers/proof_params.go | 4 ++-- internal/service/handlers/proof_params_light.go | 4 ++-- internal/service/handlers/verification_callback.go | 4 ++-- internal/service/handlers/verification_link.go | 2 +- internal/service/handlers/verification_link_light.go | 2 +- internal/service/requests/get_proof_parameters.go | 6 +++--- 9 files changed, 16 insertions(+), 16 deletions(-) diff --git a/internal/data/pg/verify_users.go b/internal/data/pg/verify_users.go index ba15076..6adc824 100644 --- a/internal/data/pg/verify_users.go +++ b/internal/data/pg/verify_users.go @@ -72,7 +72,7 @@ func (q *VerifyUsersQ) Upsert(VerifyUsers *data.VerifyUsers) (data.VerifyUsers, "age_lower_bound": VerifyUsers.AgeLowerBound, "nationality": VerifyUsers.Nationality, "uniqueness": VerifyUsers.Uniqueness, - "event_id": VerifyUsers.EventId, + "event_id": VerifyUsers.EventID, "status": VerifyUsers.Status, "proof": proofJSON, "sex": VerifyUsers.Sex, diff --git a/internal/data/verify_users.go b/internal/data/verify_users.go index 1649705..666244c 100644 --- a/internal/data/verify_users.go +++ b/internal/data/verify_users.go @@ -11,7 +11,7 @@ type VerifyUsers struct { Nationality string `db:"nationality"` CreatedAt time.Time `db:"created_at"` Uniqueness bool `db:"uniqueness"` - EventId string `db:"event_id"` + EventID string `db:"event_id"` Status string `db:"status"` Proof []byte `db:"proof"` Sex string `db:"sex"` diff --git a/internal/service/handlers/get_proof_parameters.go b/internal/service/handlers/get_proof_parameters.go index fdfc05a..762527b 100644 --- a/internal/service/handlers/get_proof_parameters.go +++ b/internal/service/handlers/get_proof_parameters.go @@ -24,7 +24,7 @@ func GetProofParameters(w http.ResponseWriter, r *http.Request) { return } - if !helpers.Authenticates(AuthClient(r), UserClaims(r), auth.UserGrant(userInputs.UserId)) { + if !helpers.Authenticates(AuthClient(r), UserClaims(r), auth.UserGrant(userInputs.UserID)) { ape.RenderErr(w, problems.Unauthorized()) return } @@ -55,8 +55,8 @@ func GetProofParameters(w http.ResponseWriter, r *http.Request) { } user := &data.VerifyUsers{ - UserID: userInputs.UserId, - UserIDHash: helpers.BytesToKeccak256Hash(common.HexToAddress(userInputs.UserId).Bytes()), + UserID: userInputs.UserID, + UserIDHash: helpers.BytesToKeccak256Hash(common.HexToAddress(userInputs.UserID).Bytes()), CreatedAt: time.Now().UTC(), Status: "not_verified", Nationality: userInputs.Nationality, diff --git a/internal/service/handlers/proof_params.go b/internal/service/handlers/proof_params.go index bdf6239..31e33fc 100644 --- a/internal/service/handlers/proof_params.go +++ b/internal/service/handlers/proof_params.go @@ -48,8 +48,8 @@ func GetProofParamsById(w http.ResponseWriter, r *http.Request) { callbackURL = fmt.Sprintf("%s/integrations/verificator-svc/public/callback/%s", Callback(r).URL, userIDHash) ) - if existingUser.EventId != "" { - eventID = existingUser.EventId + if existingUser.EventID != "" { + eventID = existingUser.EventID } if existingUser.AgeLowerBound == -1 { diff --git a/internal/service/handlers/proof_params_light.go b/internal/service/handlers/proof_params_light.go index 2900e1c..49e8379 100644 --- a/internal/service/handlers/proof_params_light.go +++ b/internal/service/handlers/proof_params_light.go @@ -48,8 +48,8 @@ func GetProofParamsLightById(w http.ResponseWriter, r *http.Request) { callbackURL = fmt.Sprintf("%s/integrations/verificator-svc/light/public/callback-sign/%s", Callback(r).URL, userIDHash) ) - if existingUser.EventId != "" { - eventID = existingUser.EventId + if existingUser.EventID != "" { + eventID = existingUser.EventID } if existingUser.AgeLowerBound == -1 { diff --git a/internal/service/handlers/verification_callback.go b/internal/service/handlers/verification_callback.go index 254f9f2..e36b210 100644 --- a/internal/service/handlers/verification_callback.go +++ b/internal/service/handlers/verification_callback.go @@ -104,8 +104,8 @@ func VerificationCallback(w http.ResponseWriter, r *http.Request) { verifiedUser.Status = "verified" - if verifiedUser.EventId != "" { - eventID = verifiedUser.EventId + if verifiedUser.EventID != "" { + eventID = verifiedUser.EventID } if verifiedUser.Uniqueness { diff --git a/internal/service/handlers/verification_link.go b/internal/service/handlers/verification_link.go index 4d4dcdf..4c695b6 100644 --- a/internal/service/handlers/verification_link.go +++ b/internal/service/handlers/verification_link.go @@ -41,7 +41,7 @@ func VerificationLink(w http.ResponseWriter, r *http.Request) { } if req.Data.Attributes.EventId != nil && *req.Data.Attributes.EventId != "" { - user.EventId = *req.Data.Attributes.EventId + user.EventID = *req.Data.Attributes.EventId } if req.Data.Attributes.AgeLowerBound != nil { diff --git a/internal/service/handlers/verification_link_light.go b/internal/service/handlers/verification_link_light.go index 1a16540..f29b951 100644 --- a/internal/service/handlers/verification_link_light.go +++ b/internal/service/handlers/verification_link_light.go @@ -41,7 +41,7 @@ func VerificationLinkLight(w http.ResponseWriter, r *http.Request) { } if req.Data.Attributes.EventId != nil && *req.Data.Attributes.EventId != "" { - user.EventId = *req.Data.Attributes.EventId + user.EventID = *req.Data.Attributes.EventId } if req.Data.Attributes.AgeLowerBound != nil { diff --git a/internal/service/requests/get_proof_parameters.go b/internal/service/requests/get_proof_parameters.go index d1cd8ff..445fec0 100644 --- a/internal/service/requests/get_proof_parameters.go +++ b/internal/service/requests/get_proof_parameters.go @@ -11,7 +11,7 @@ import ( ) type UserInputs struct { - UserId string `url:"user_id"` + UserID string `url:"user_id"` AgeLowerBound int `url:"age_lower_bound"` Uniqueness bool `url:"uniqueness"` Nationality string `url:"nationality"` @@ -25,10 +25,10 @@ func NewGetUserInputs(r *http.Request) (userInputs UserInputs, err error) { return } - userInputs.UserId = strings.ToLower(userInputs.UserId) + userInputs.UserID = strings.ToLower(userInputs.UserID) err = val.Errors{ - "user_id": val.Validate(userInputs.UserId, val.Required), + "user_id": val.Validate(userInputs.UserID, val.Required), "age_lower_bound": val.Validate(userInputs.AgeLowerBound, val.Required), "uniqueness": val.Validate(val.Required), "nationality": val.Validate(userInputs.Nationality, val.Required),