Skip to content

Commit

Permalink
refactor: Change camelCase to cabab-case for query params
Browse files Browse the repository at this point in the history
  • Loading branch information
cheatsnake committed Jan 29, 2023
1 parent 550aae4 commit b833a81
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
40 changes: 20 additions & 20 deletions internal/handlers/math.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@ const (
)

func MathAddition(c *fiber.Ctx) error {
minFirst := helpers.GetQueryInt(c, "minFirst", mathMin)
maxFirst := helpers.GetQueryInt(c, "maxFirst", mathMax)
minSecond := helpers.GetQueryInt(c, "minSecond", mathMin)
maxSecond := helpers.GetQueryInt(c, "maxSecond", mathMax)
minFirst := helpers.GetQueryInt(c, "min-first", mathMin)
maxFirst := helpers.GetQueryInt(c, "max-first", mathMax)
minSecond := helpers.GetQueryInt(c, "min-second", mathMin)
maxSecond := helpers.GetQueryInt(c, "max-second", mathMax)

result := math.GetAddition(minFirst, maxFirst, minSecond, maxSecond)

return c.JSON(result)
}

func MathSubtraction(c *fiber.Ctx) error {
minFirst := helpers.GetQueryInt(c, "minFirst", mathMin)
maxFirst := helpers.GetQueryInt(c, "maxFirst", mathMax)
minSecond := helpers.GetQueryInt(c, "minSecond", mathMin)
maxSecond := helpers.GetQueryInt(c, "maxSecond", mathMax)
minFirst := helpers.GetQueryInt(c, "min-first", mathMin)
maxFirst := helpers.GetQueryInt(c, "max-first", mathMax)
minSecond := helpers.GetQueryInt(c, "min-second", mathMin)
maxSecond := helpers.GetQueryInt(c, "max-second", mathMax)
negative := helpers.GetQueryInt(c, "negative", mathNegative)
allowNegative := negative == 1

Expand All @@ -39,32 +39,32 @@ func MathSubtraction(c *fiber.Ctx) error {
}

func MathMultiplication(c *fiber.Ctx) error {
minFirst := helpers.GetQueryInt(c, "minFirst", mathMin)
maxFirst := helpers.GetQueryInt(c, "maxFirst", mathMax)
minSecond := helpers.GetQueryInt(c, "minSecond", mathMin)
maxSecond := helpers.GetQueryInt(c, "maxSecond", mathMax)
minFirst := helpers.GetQueryInt(c, "min-first", mathMin)
maxFirst := helpers.GetQueryInt(c, "max-first", mathMax)
minSecond := helpers.GetQueryInt(c, "min-second", mathMin)
maxSecond := helpers.GetQueryInt(c, "max-second", mathMax)

result := math.GetMultiplication(minFirst, maxFirst, minSecond, maxSecond)

return c.JSON(result)
}

func MathDivision(c *fiber.Ctx) error {
minFirst := helpers.GetQueryInt(c, "minFirst", mathMin)
maxFirst := helpers.GetQueryInt(c, "maxFirst", mathMax)
minFirst := helpers.GetQueryInt(c, "min-first", mathMin)
maxFirst := helpers.GetQueryInt(c, "max-first", mathMax)

result := math.GetDivision(minFirst, maxFirst)

return c.JSON(result)
}

func MathQuadratic(c *fiber.Ctx) error {
minA := helpers.GetQueryInt(c, "minA", mathQuadMin)
minB := helpers.GetQueryInt(c, "minB", mathQuadMin)
minC := helpers.GetQueryInt(c, "minC", mathQuadMin)
maxA := helpers.GetQueryInt(c, "maxA", mathQuadMax)
maxB := helpers.GetQueryInt(c, "maxB", mathQuadMax*2)
maxC := helpers.GetQueryInt(c, "maxC", mathQuadMax)
minA := helpers.GetQueryInt(c, "min-a", mathQuadMin)
minB := helpers.GetQueryInt(c, "min-b", mathQuadMin)
minC := helpers.GetQueryInt(c, "min-c", mathQuadMin)
maxA := helpers.GetQueryInt(c, "max-a", mathQuadMax)
maxB := helpers.GetQueryInt(c, "max-b", mathQuadMax*2)
maxC := helpers.GetQueryInt(c, "max-c", mathQuadMax)

result := math.GetQuadratic(minA, maxA, minB, maxB, minC, maxC)

Expand Down
4 changes: 2 additions & 2 deletions internal/handlers/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func init() {
}

func SetGameStart(c *fiber.Ctx) error {
posSets, err := strconv.ParseBool(c.Query("possibleSets"))
posSets, err := strconv.ParseBool(c.Query("possible-sets"))
if err != nil {
posSets = possibleSets
}
Expand All @@ -40,7 +40,7 @@ func SetGameAllCards(c *fiber.Ctx) error {
func SetGameLoadState(c *fiber.Ctx) error {
state := c.Params("state")
action := c.Query("action")
posSets, err := strconv.ParseBool(c.Query("possibleSets"))
posSets, err := strconv.ParseBool(c.Query("possible-sets"))
if err != nil {
posSets = possibleSets
}
Expand Down

0 comments on commit b833a81

Please sign in to comment.