Skip to content

Commit

Permalink
feat: getAllUnClaimedList
Browse files Browse the repository at this point in the history
  • Loading branch information
KieSun committed Oct 19, 2024
1 parent 9426e9c commit e039bf9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/controller/contribution.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,10 @@ export class ContributionController {
const data = await this.contributionService.syncUnClaimed(chainId);
return CoreApiResponse.success(data);
}

@Get('allUnClaimedList')
async allUnClaimedList(@Query() query: ContributionListQuery) {
const data = await this.contributionService.getAllUnClaimedList(query);
return CoreApiResponse.success(data);
}
}
18 changes: 18 additions & 0 deletions src/core/service/contribution.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -394,4 +394,22 @@ export class ContributionService {
}
return unClaimed;
}

async getAllUnClaimedList(query: ContributionListQuery) {
const { projectId, endDateFrom, endDateTo } = query;
const where = {
deleted: false,
projectId,
status: Status.READY,
};
if (endDateTo && endDateFrom) {
where['endDate'] = {
gte: new Date(endDateFrom),
lte: new Date(endDateTo),
};
}
return this.prisma.contribution.findMany({
where,
});
}
}

0 comments on commit e039bf9

Please sign in to comment.