Skip to content

Commit

Permalink
Update src/resolvers/recurringDonationResolver.ts
Browse files Browse the repository at this point in the history
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
  • Loading branch information
CarlosQ96 and coderabbitai[bot] authored Dec 16, 2024
1 parent 86fbca9 commit 364cfbc
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/resolvers/recurringDonationResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -765,9 +765,13 @@ export class RecurringDonationResolver {
try {
const offset = (page - 1) * limit;

const queryParams = [offset, limit];
let networkFilter = '';
let paramIndex = 3;
if (networkId) {
networkFilter = `AND anchor_contract_address."networkId" = ${networkId}`;
networkFilter = `AND anchor_contract_address."networkId" = $${paramIndex}`;
queryParams.push(networkId);
paramIndex++;
}

return await Project.getRepository().query(`

Check failure on line 777 in src/resolvers/recurringDonationResolver.ts

View workflow job for this annotation

GitHub Actions / test

Insert `⏎········`
Expand All @@ -786,9 +790,9 @@ export class RecurringDonationResolver {
AND anchor_contract_address."isActive" = true
${networkFilter}
GROUP BY project.id, project.slug, project.title
OFFSET ${offset}
LIMIT ${limit}
`);
OFFSET $1
LIMIT $2
`, queryParams);

Check failure on line 795 in src/resolvers/recurringDonationResolver.ts

View workflow job for this annotation

GitHub Actions / test

Replace `·queryParams` with `⏎········queryParams,⏎······`
} catch (error) {
throw new Error(
`Error fetching eligible projects for donation: ${error}`,
Expand Down

0 comments on commit 364cfbc

Please sign in to comment.