Skip to content

Commit

Permalink
fix: fixed get by id route
Browse files Browse the repository at this point in the history
  • Loading branch information
SohamGhugare committed Dec 19, 2023
1 parent 8398802 commit 6c26d60
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
2 changes: 1 addition & 1 deletion api/controllers/mapRoutes.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func MapRoutes(r *gin.Engine) {

sponGroup.POST("/create", controllers.CreateSponsorship)
sponGroup.GET("/", controllers.GetSponsorships)
sponGroup.GET("/", controllers.GetSponsorshipById)
sponGroup.GET("/:id", controllers.GetSponsorshipById)
sponGroup.GET("/update", controllers.UpdateSponsorshipStatus)
sponGroup.DELETE("/", controllers.DeleteSponsorship)

Expand Down
6 changes: 1 addition & 5 deletions api/controllers/v1/sponsorship.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,7 @@ func CreateSponsorship(c *gin.Context) {
}

func GetSponsorshipById(c *gin.Context) {
id, exists := c.GetQuery("id")
if !exists {
utility.GinCtxError(c, "Please pass in ID")
return
}
id := c.Param("id")
idInt, _ := strconv.Atoi(id)
spon, err := database.GetSponsorshipById(idInt)
if err != nil {
Expand Down

0 comments on commit 6c26d60

Please sign in to comment.