Skip to content

Commit

Permalink
Merge pull request #409 from desci-labs/hotfix/claim-all-optional-att…
Browse files Browse the repository at this point in the history
…estations

hotfix: add support to claim all optional attestations
  • Loading branch information
hubsmoke authored Jun 27, 2024
2 parents ded3eea + 73214a1 commit 4b73e66
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion desci-server/src/controllers/attestations/claims.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export const claimEntryRequirements = async (req: Request, res: Response, _next:
logger.info({ communityId, body: req.body }, 'claimEntryRequirements');
const uuid = ensureUuidEndsWithDot(nodeUuid);

const entryAttestations = await attestationService.getCommunityEntryAttestations(communityId);
const entryAttestations = await attestationService.getAllCommunityEntryAttestations(communityId);
logger.info({ entryAttestations });

const claimables = (await asyncMap(entryAttestations, async (attestation) => {
Expand Down
4 changes: 2 additions & 2 deletions desci-server/src/routes/v1/attestations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ import {

const router = Router();

router.get('/suggestions/all', [ensureUser], asyncHander(getAllRecommendations));
router.get('/suggestions/protected', [ensureUser], asyncHander(getValidatedRecommendations));
router.get('/suggestions/all', [], asyncHander(getAllRecommendations));
router.get('/suggestions/protected', [], asyncHander(getValidatedRecommendations));
router.get(
'/claims/:communityId/:dpid',
[ensureUser, validate(showCommunityClaimsSchema)],
Expand Down
6 changes: 6 additions & 0 deletions desci-server/src/services/Attestation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,12 @@ export class AttestationService {
return prisma.communityEntryAttestation.findMany({ where: { desciCommunityId: communityId, required: true } });
}

async getAllCommunityEntryAttestations(communityId: number) {
const community = await communityService.findCommunityById(communityId);
if (!community) throw new CommunityNotFoundError();
return prisma.communityEntryAttestation.findMany({ where: { desciCommunityId: communityId } });
}

async claimAttestation({
attestationId,
attestationVersion,
Expand Down

0 comments on commit 4b73e66

Please sign in to comment.