Skip to content

Commit

Permalink
[SHR-29] enhance: add field organization rating to get campaign detai…
Browse files Browse the repository at this point in the history
…l API (#179)
  • Loading branch information
phamhongphuc1403 authored Mar 31, 2024
1 parent c53378f commit 47af6d9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 6 additions & 2 deletions backend/src/core/modules/campaign/campaign.repository.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@ class Repository extends DataRepository {
{ registerLink: 'campaigns.register_link' },
{ donationRequirement: 'campaigns.donation_requirement' },
'campaigns.coordinate',
{ organizationName: 'organizations.name' },
{ organizationId: 'campaigns.organization_id' },
{ organizationAvatar: 'organizations.avatar' }
{ organization: connection.raw(`json_build_object(
'name', organizations.name,
'avatar', organizations.avatar,
'id', campaigns.organization_id,
'rating', 4.9
)`)}
]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ class Repository extends DataRepository {
}

findAllDonationsByUserId(userId) {
console.log(userId)
return this.query()
.where('donation_records.donor_id', '=', userId)
.join('campaigns', 'donation_records.campaign_id', 'campaigns.id')
Expand Down

0 comments on commit 47af6d9

Please sign in to comment.