Skip to content

Commit 51ce606

Browse files
committed
Add isWinner param to GET /tokens
1 parent cc02d7e commit 51ce606

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/app.service.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export class AppService {
3232
}
3333

3434
async getTokens(dto: GetTokensDto){
35-
const { search, offset, limit } = dto
35+
const { search, offset, limit, isWinner } = dto
3636
const query = this.dataSource.getRepository(Token)
3737
.createQueryBuilder('token')
3838
.leftJoinAndSelect('token.user', 'user')
@@ -50,6 +50,10 @@ export class AppService {
5050
.orWhere('LOWER(token.txnHash) = LOWER(:txnHash)', { txnHash: search })
5151
}
5252

53+
if(typeof isWinner !== 'undefined') {
54+
query.andWhere({ isWinner })
55+
}
56+
5357
return await query.getMany()
5458
}
5559

src/dto/token.dto.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ export class GetTokensDto {
88
// @IsString()
99
search?: string;
1010

11+
@ApiProperty({ type: Boolean, required: false })
12+
isWinner?: boolean;
13+
1114
@ApiProperty({ type: Number, required: false, default: '100' })
1215
// @Transform((limit) => limit.value.toNumber())
1316
@Type(() => String)

0 commit comments

Comments
 (0)