Skip to content

Commit 7fdac44

Browse files
Merge pull request #96 from ABHINAVGARG05/master
fix in idea route
2 parents fa95fef + 9db153a commit 7fdac44

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

pkg/controller/admin.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,13 +737,18 @@ func GetIdeasByTrack(c echo.Context) error {
737737
TrackParam := c.QueryParam("track")
738738
TitleParam := c.QueryParam("title")
739739

740+
if TrackParam == " " || TitleParam == "" {
741+
TrackParam = "7"
742+
}
743+
740744
TrackParamInt, err := strconv.Atoi(TrackParam)
741745
if err != nil {
742746
return c.JSON(http.StatusBadRequest, &models.Response{
743747
Status: "fail",
744748
Message: err.Error(),
745749
})
746750
}
751+
747752
if TrackParamInt < 1 || TrackParamInt > 6 {
748753
TrackParamInt = 7
749754
}
@@ -755,6 +760,7 @@ func GetIdeasByTrack(c echo.Context) error {
755760
Track: TrackParamInt,
756761
Title: TitleParam,
757762
}
763+
758764
limitParam := c.QueryParam("limit")
759765
cursor := c.QueryParam("cursor")
760766

@@ -774,6 +780,7 @@ func GetIdeasByTrack(c echo.Context) error {
774780
}
775781

776782
var cursorUUID uuid.UUID
783+
777784
if cursor == "" {
778785
cursorUUID = uuid.Nil
779786
} else {
@@ -883,7 +890,7 @@ func GetIdeasByTrack(c echo.Context) error {
883890
})
884891
}
885892
case 7:
886-
trackname := tracks[7]
893+
trackname := tracks[6]
887894
idea, err = utils.Queries.GetIdeasByTrack(ctx, db.GetIdeasByTrackParams{
888895
Column1: &payload.Title,
889896
Column2: &trackname,

0 commit comments

Comments
 (0)