Skip to content

Commit

Permalink
update api
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoch05 committed Nov 6, 2024
1 parent f6b7126 commit 7f45236
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 18 deletions.
28 changes: 11 additions & 17 deletions apollo/src/app.controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Controller, Get, Query } from '@nestjs/common';
import { Controller, Get, Query, Param } from '@nestjs/common';
import { AppService } from './app.service';

@Controller()
Expand All @@ -10,31 +10,25 @@ export class AppController {
return this.appService.getHello();
}

@Get('questn/used')
async questNUsedHelix(@Query('address') address: string) {
return await this.appService.questNUsedHelix(
@Get('quest/used')
async questUsedHelix(@Query('address') address: string) {
return await this.appService.questUsedHelix(
{
sender: address.toLowerCase(),
},
1
);
}

@Get('questn/usedafter')
async questNUsedAfter(@Query('address') address: string) {
@Get('quest/after/:timestamp/times/:times')
async questUsedAfterAnd3Times(
@Param('timestamp') timestamp: number,
@Param('times') times: number,
@Query('address') address: string) {
const where = {
sender: address.toLowerCase(),
startTime: { gt: 1729428516 },
startTime: { gt: timestamp },
};
return await this.appService.questNUsedHelix(where, 1);
}

@Get('questn/afterand3times')
async questNUsedAfterAnd3Times(@Query('address') address: string) {
const where = {
sender: address.toLowerCase(),
startTime: { gt: 1729428516 },
};
return await this.appService.questNUsedHelix(where, 3);
return await this.appService.questUsedHelix(where, times);
}
}
2 changes: 1 addition & 1 deletion apollo/src/app.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export class AppService extends PrismaClient {
return 'Hello World!';
}

async questNUsedHelix(where: Prisma.HistoryRecordWhereInput, times: number) {
async questUsedHelix(where: Prisma.HistoryRecordWhereInput, times: number) {
const total = await this.historyRecord.count({
where,
});
Expand Down

0 comments on commit 7f45236

Please sign in to comment.