Skip to content

Commit bbd57d7

Browse files
committed
added not condition for privado
1 parent ca1bffd commit bbd57d7

File tree

1 file changed

+23
-19
lines changed

1 file changed

+23
-19
lines changed

src/resolvers/userResolver.ts

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,15 @@ export class UserResolver {
646646
'user.privadoVerifiedRequestIds',
647647
'user.skipVerification',
648648
]);
649+
if (hasDonated) {
650+
query.andWhere(
651+
`EXISTS (
652+
SELECT 1 FROM donation d
653+
WHERE d."userId" = user.id AND d.status = :status
654+
)`,
655+
{ status: DONATION_STATUS.VERIFIED },
656+
);
657+
}
649658

650659
if (privadoVerified === true) {
651660
// Add the filter for users who are privado verified
@@ -658,25 +667,20 @@ export class UserResolver {
658667
}
659668

660669
if (humanVerified === true) {
661-
query.andWhere(
662-
new Brackets(qb => {
663-
qb.where('user.passportScore >= :passportScoreThreshold', {
664-
passportScoreThreshold: GITCOIN_PASSPORT_MIN_VALID_SCORER_SCORE,
665-
}).orWhere('user.analysisScore >= :analysisScoreThreshold', {
666-
analysisScoreThreshold: GITCOIN_PASSPORT_MIN_VALID_ANALYSIS_SCORE,
667-
});
668-
}),
669-
);
670-
}
671-
672-
if (hasDonated) {
673-
query.andWhere(
674-
`EXISTS (
675-
SELECT 1 FROM donation d
676-
WHERE d."userId" = user.id AND d.status = :status
677-
)`,
678-
{ status: DONATION_STATUS.VERIFIED },
679-
);
670+
query
671+
.andWhere(
672+
new Brackets(qb => {
673+
qb.where('user.passportScore >= :passportScoreThreshold', {
674+
passportScoreThreshold: GITCOIN_PASSPORT_MIN_VALID_SCORER_SCORE,
675+
}).orWhere('user.analysisScore >= :analysisScoreThreshold', {
676+
analysisScoreThreshold: GITCOIN_PASSPORT_MIN_VALID_ANALYSIS_SCORE,
677+
});
678+
}),
679+
)
680+
.andWhere(
681+
'NOT (:privadoRequestId = ANY (user.privadoVerifiedRequestIds))',
682+
{ privadoRequestId: PrivadoAdapter.privadoRequestId },
683+
); // Negate the condition for privadoVerified
680684
}
681685

682686
const [users, totalCount] = await query.getManyAndCount();

0 commit comments

Comments
 (0)