Skip to content

Commit 2c56938

Browse files
committed
Merge branch 'staging' of https://github.com/GeneralMagicio/QAcc-BE into staging
2 parents a01560b + 54dddf9 commit 2c56938

File tree

3 files changed

+51
-3
lines changed

3 files changed

+51
-3
lines changed

src/resolvers/donationResolver.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,15 @@ class DonationMetrics {
218218
averagePercentageToGiveth: number;
219219
}
220220

221+
@ObjectType()
222+
class TotalDonations {
223+
@Field(_type => [Donation])
224+
donations: Donation[];
225+
226+
@Field(_type => Int)
227+
totalCount: number;
228+
}
229+
221230
@InputType()
222231
class SwapTransactionInput {
223232
@Field({ nullable: true })
@@ -1130,4 +1139,25 @@ export class DonationResolver {
11301139
throw e;
11311140
}
11321141
}
1142+
1143+
@Query(_returns => TotalDonations, { nullable: true })
1144+
async donationsByQfRoundId(
1145+
@Ctx() _ctx: ApolloContext,
1146+
@Arg('qfRoundId', _type => Int) qfRoundId: number,
1147+
) {
1148+
const query = this.donationRepository
1149+
.createQueryBuilder('donation')
1150+
.leftJoin('donation.project', 'project')
1151+
.leftJoin('donation.user', 'user')
1152+
.addSelect(['project.title', 'project.abc', 'project.id', 'user.id'])
1153+
.where('donation.qfRoundId = :qfRoundId', { qfRoundId })
1154+
.orderBy('donation.createdAt', 'DESC');
1155+
1156+
const [donations, totalCount] = await query.getManyAndCount();
1157+
1158+
return {
1159+
donations,
1160+
totalCount: totalCount,
1161+
};
1162+
}
11331163
}

src/services/donationService.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ function syncDonationStatusWithBlockchainNetworkTestCases() {
151151
sinon.restore();
152152
});
153153

154-
it('should verify a Polygon donation', async () => {
154+
it.skip('should verify a Polygon donation', async () => {
155155
// https://polygonscan.com/tx/0x16f122ad45705dfa41bb323c3164b6d840cbb0e9fa8b8e58bd7435370f8bbfc8
156156

157157
const updateDonation = await syncDonationStatusWithBlockchainNetwork({
@@ -163,7 +163,7 @@ function syncDonationStatusWithBlockchainNetworkTestCases() {
163163
assert.equal(updateDonation.status, DONATION_STATUS.VERIFIED);
164164
});
165165

166-
it('should associate donation to overlapping early access round after verification', async () => {
166+
it.skip('should associate donation to overlapping early access round after verification', async () => {
167167
sinon.stub(chains, 'validateTransactionWithInputData');
168168
ea = await EarlyAccessRound.create({
169169
roundNumber: generateEARoundNumber(),
@@ -189,7 +189,7 @@ function syncDonationStatusWithBlockchainNetworkTestCases() {
189189
// assert.equal(updateDonation.earlyAccessRoundId, ea.id);
190190
});
191191

192-
it('should associate donation to overlapping qf round after verification', async () => {
192+
it.skip('should associate donation to overlapping qf round after verification', async () => {
193193
sinon.stub(chains, 'validateTransactionWithInputData');
194194
qf = await QfRound.create({
195195
roundNumber: 1,

test/graphqlQueries.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2270,3 +2270,21 @@ export const setSkipVerificationMutation = `
22702270
setSkipVerification(skipVerification: $skipVerification)
22712271
}
22722272
`;
2273+
2274+
export const getDonationsByQfRoundId = `
2275+
query donationsByQfRoundId($qfRoundId: Int!) {
2276+
donationsByQfRoundId(qfRoundId: $qfRoundId) {
2277+
donations {
2278+
amount
2279+
createdAt
2280+
project {
2281+
id
2282+
}
2283+
user {
2284+
id
2285+
}
2286+
}
2287+
totalCount
2288+
}
2289+
}
2290+
`;

0 commit comments

Comments
 (0)