replace Id with ID

This commit is contained in:
2025-02-13 08:00:49 -06:00
parent f948a06b66
commit 32facb1767
19 changed files with 172 additions and 169 deletions

View File

@@ -19,9 +19,9 @@ type NkodeHandler struct {
}
const (
malformedCustomerId = "malformed customer id"
malformedCustomerID = "malformed customer id"
malformedUserEmail = "malformed user email"
malformedSessionId = "malformed session id"
malformedSessionID = "malformed session id"
invalidKeypadDimensions = "invalid keypad dimensions"
)
@@ -78,9 +78,9 @@ func (h *NkodeHandler) SignupHandler(c *gin.Context) {
return
}
customerId, err := uuid.Parse(postBody.CustomerId)
customerId, err := uuid.Parse(postBody.CustomerID)
if err != nil {
c.String(400, malformedCustomerId)
c.String(400, malformedCustomerID)
return
}
@@ -90,7 +90,7 @@ func (h *NkodeHandler) SignupHandler(c *gin.Context) {
return
}
resp, err := h.API.GenerateSignupResetInterface(userEmail, entities.CustomerId(customerId), kp, false)
resp, err := h.API.GenerateSignupResetInterface(userEmail, entities.CustomerID(customerId), kp, false)
if err != nil {
handleError(c, err)
return
@@ -106,18 +106,18 @@ func (h *NkodeHandler) SetNKodeHandler(c *gin.Context) {
handleError(c, err)
return
}
customerId, err := uuid.Parse(postBody.CustomerId)
customerId, err := uuid.Parse(postBody.CustomerID)
if err != nil {
c.String(400, malformedCustomerId)
c.String(400, malformedCustomerID)
return
}
sessionId, err := uuid.Parse(postBody.SessionId)
sessionId, err := uuid.Parse(postBody.SessionID)
if err != nil {
c.String(400, malformedSessionId)
c.String(400, malformedSessionID)
return
}
confirmInterface, err := h.API.SetNKode(entities.CustomerId(customerId), entities.SessionId(sessionId), postBody.KeySelection)
confirmInterface, err := h.API.SetNKode(entities.CustomerID(customerId), entities.SessionID(sessionId), postBody.KeySelection)
if err != nil {
handleError(c, err)
return
@@ -133,17 +133,17 @@ func (h *NkodeHandler) ConfirmNKodeHandler(c *gin.Context) {
handleError(c, err)
return
}
customerId, err := uuid.Parse(postBody.CustomerId)
customerId, err := uuid.Parse(postBody.CustomerID)
if err != nil {
c.String(400, malformedCustomerId)
c.String(400, malformedCustomerID)
return
}
sessionId, err := uuid.Parse(postBody.SessionId)
sessionId, err := uuid.Parse(postBody.SessionID)
if err != nil {
c.String(400, malformedSessionId)
c.String(400, malformedSessionID)
return
}
if err := h.API.ConfirmNKode(entities.CustomerId(customerId), entities.SessionId(sessionId), postBody.KeySelection); err != nil {
if err := h.API.ConfirmNKode(entities.CustomerID(customerId), entities.SessionID(sessionId), postBody.KeySelection); err != nil {
handleError(c, err)
return
}
@@ -158,9 +158,9 @@ func (h *NkodeHandler) GetLoginInterfaceHandler(c *gin.Context) {
return
}
customerId, err := uuid.Parse(loginInterfacePost.CustomerId)
customerId, err := uuid.Parse(loginInterfacePost.CustomerID)
if err != nil {
c.String(400, malformedCustomerId)
c.String(400, malformedCustomerID)
return
}
@@ -169,7 +169,7 @@ func (h *NkodeHandler) GetLoginInterfaceHandler(c *gin.Context) {
c.String(400, malformedUserEmail)
return
}
postBody, err := h.API.GetLoginInterface(userEmail, entities.CustomerId(customerId))
postBody, err := h.API.GetLoginInterface(userEmail, entities.CustomerID(customerId))
if err != nil {
handleError(c, err)
return
@@ -185,9 +185,9 @@ func (h *NkodeHandler) LoginHandler(c *gin.Context) {
handleError(c, err)
return
}
customerId, err := uuid.Parse(loginPost.CustomerId)
customerId, err := uuid.Parse(loginPost.CustomerID)
if err != nil {
c.String(400, malformedCustomerId)
c.String(400, malformedCustomerID)
return
}
@@ -196,7 +196,7 @@ func (h *NkodeHandler) LoginHandler(c *gin.Context) {
c.String(400, malformedUserEmail)
return
}
jwtToken, err := h.API.Login(entities.CustomerId(customerId), userEmail, loginPost.KeySelection)
jwtToken, err := h.API.Login(entities.CustomerID(customerId), userEmail, loginPost.KeySelection)
if err != nil {
handleError(c, err)
return
@@ -213,13 +213,13 @@ func (h *NkodeHandler) RenewAttributesHandler(c *gin.Context) {
return
}
customerId, err := uuid.Parse(renewAttributesPost.CustomerId)
customerId, err := uuid.Parse(renewAttributesPost.CustomerID)
if err != nil {
c.String(400, malformedCustomerId)
c.String(400, malformedCustomerID)
return
}
if err = h.API.RenewAttributes(entities.CustomerId(customerId)); err != nil {
if err = h.API.RenewAttributes(entities.CustomerID(customerId)); err != nil {
handleError(c, err)
return
}
@@ -251,7 +251,7 @@ func (h *NkodeHandler) RefreshTokenHandler(c *gin.Context) {
}
customerId, err := uuid.Parse(refreshClaims.Issuer)
if err != nil {
c.String(400, malformedCustomerId)
c.String(400, malformedCustomerID)
return
}
userEmail, err := entities.ParseEmail(refreshClaims.Subject)
@@ -259,7 +259,7 @@ func (h *NkodeHandler) RefreshTokenHandler(c *gin.Context) {
c.String(400, malformedUserEmail)
return
}
accessToken, err := h.API.RefreshToken(userEmail, entities.CustomerId(customerId), refreshToken)
accessToken, err := h.API.RefreshToken(userEmail, entities.CustomerID(customerId), refreshToken)
if err != nil {
handleError(c, err)
return
@@ -274,9 +274,9 @@ func (h *NkodeHandler) ForgotNKodeHandler(c *gin.Context) {
handleError(c, err)
return
}
customerId, err := uuid.Parse(forgotNKodePost.CustomerId)
customerId, err := uuid.Parse(forgotNKodePost.CustomerID)
if err != nil {
c.String(400, malformedCustomerId)
c.String(400, malformedCustomerID)
return
}
userEmail, err := entities.ParseEmail(forgotNKodePost.UserEmail)
@@ -285,7 +285,7 @@ func (h *NkodeHandler) ForgotNKodeHandler(c *gin.Context) {
return
}
if err := h.API.ForgotNKode(userEmail, entities.CustomerId(customerId)); err != nil {
if err := h.API.ForgotNKode(userEmail, entities.CustomerID(customerId)); err != nil {
handleError(c, err)
return
}
@@ -306,7 +306,7 @@ func (h *NkodeHandler) SignoutHandler(c *gin.Context) {
}
customerId, err := uuid.Parse(accessClaims.Issuer)
if err != nil {
c.String(400, malformedCustomerId)
c.String(400, malformedCustomerID)
return
}
userEmail, err := entities.ParseEmail(accessClaims.Subject)
@@ -314,7 +314,7 @@ func (h *NkodeHandler) SignoutHandler(c *gin.Context) {
c.String(400, malformedUserEmail)
return
}
if err = h.API.Signout(userEmail, entities.CustomerId(customerId)); err != nil {
if err = h.API.Signout(userEmail, entities.CustomerID(customerId)); err != nil {
handleError(c, err)
return
}
@@ -339,9 +339,9 @@ func (h *NkodeHandler) ResetHandler(c *gin.Context) {
handleError(c, err)
return
}
customerId, err := uuid.Parse(postBody.CustomerId)
customerId, err := uuid.Parse(postBody.CustomerID)
if err != nil {
c.String(400, malformedCustomerId)
c.String(400, malformedCustomerID)
return
}
userEmail, err := entities.ParseEmail(postBody.UserEmail)
@@ -350,7 +350,7 @@ func (h *NkodeHandler) ResetHandler(c *gin.Context) {
return
}
if postBody.UserEmail != resetClaims.Subject ||
postBody.CustomerId != resetClaims.Issuer {
postBody.CustomerID != resetClaims.Issuer {
c.String(403, "forbidden")
return
}
@@ -364,7 +364,7 @@ func (h *NkodeHandler) ResetHandler(c *gin.Context) {
c.String(400, invalidKeypadDimensions)
return
}
resp, err := h.API.GenerateSignupResetInterface(userEmail, entities.CustomerId(customerId), kp, true)
resp, err := h.API.GenerateSignupResetInterface(userEmail, entities.CustomerID(customerId), kp, true)
if err != nil {
handleError(c, err)
return