Skip to content

Commit

Permalink
fix: small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
WaDadidou committed Jul 6, 2024
1 parent 63e12d3 commit a7a6b63
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions go/pkg/launchpad/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ func (s *Launchpad) CollectionsByCreator(ctx context.Context, req *launchpadpb.C
orderSQL = "lp.collection_name" + orderDirection
}

err = s.conf.IndexerDB.Raw(`SELECT collection_data from launchpad_projects ORDER BY %s`,
err = s.conf.IndexerDB.Raw(fmt.Sprintf(`SELECT collection_data from launchpad_projects ORDER BY %s`,
orderSQL, // ORDER BY here or it won't work
).Scan(&projects).Error
if err != nil {
Expand Down Expand Up @@ -310,10 +310,10 @@ func (s *Launchpad) LaunchpadProjects(ctx context.Context, req *launchpadpb.Laun
userAddress,
).Scan(&isUserAuthorized).Error
if err != nil {
return errors.Wrap(err, "failed to query database")
return nil, errors.Wrap(err, "failed to query database")
}
if !isUserAuthorized {
return errors.New("Unauthorized")
return nil, errors.New("Unauthorized")
}

var projects []launchpadpb.LaunchpadProject
Expand All @@ -332,9 +332,9 @@ func (s *Launchpad) LaunchpadProjects(ctx context.Context, req *launchpadpb.Laun
orderSQL = "lp.collection_name" + orderDirection
}

err = s.conf.IndexerDB.Raw(`SELECT * from launchpad_projects ORDER BY %s`,
err = s.conf.IndexerDB.Raw(fmt.Sprintf(`SELECT * from launchpad_projects ORDER BY %s`,
orderSQL, // ORDER BY here or it won't work
).Scan(&projects).Error
)).Scan(&projects).Error
if err != nil {
return nil, errors.Wrap(err, "failed to query database")
}
Expand Down

0 comments on commit a7a6b63

Please sign in to comment.