Skip to content

Commit 005cd8d

Browse files
csg-pr-botDev Agent
authored andcommitted
Fix api/v1/spaces API with trending and sdk query bug (#961)
Co-authored-by: Dev Agent <dev-agent@example.com>
1 parent 5a4ecd0 commit 005cd8d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

builder/store/database/repository.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ func (s *repoStoreImpl) PublicToUser(ctx context.Context, repoType types.Reposit
732732
}
733733

734734
if len(filter.SpaceSDK) > 0 {
735-
q.Where("spaces.sdk = ?", filter.SpaceSDK)
735+
q.Where("EXISTS (SELECT 1 FROM spaces s WHERE s.repository_id = repository.id AND s.sdk = ?)", filter.SpaceSDK)
736736
}
737737

738738
if len(filter.Tags) > 0 {
@@ -851,7 +851,7 @@ func (s *repoStoreImpl) publicToUserTrending(ctx context.Context, repoType types
851851
}
852852

853853
if len(filter.SpaceSDK) > 0 {
854-
q.Where("spaces.sdk = ?", filter.SpaceSDK)
854+
q.Where("EXISTS (SELECT 1 FROM spaces s WHERE s.repository_id = r.id AND s.sdk = ?)", filter.SpaceSDK)
855855
}
856856

857857
if len(filter.Tags) > 0 {

0 commit comments

Comments
 (0)