add score controller
This commit is contained in:
@@ -24,6 +24,7 @@ model User {
|
|||||||
googleID String? @unique
|
googleID String? @unique
|
||||||
isGuest Boolean @default(false)
|
isGuest Boolean @default(false)
|
||||||
partyPlayed Int @default(0)
|
partyPlayed Int @default(0)
|
||||||
|
totalScore Int @default(0)
|
||||||
LessonHistory LessonHistory[]
|
LessonHistory LessonHistory[]
|
||||||
SongHistory SongHistory[]
|
SongHistory SongHistory[]
|
||||||
searchHistory SearchHistory[]
|
searchHistory SearchHistory[]
|
||||||
|
|||||||
@@ -294,4 +294,19 @@ export class AuthController {
|
|||||||
) {
|
) {
|
||||||
return this.usersService.getLikedSongs(+req.user.id)
|
return this.usersService.getLikedSongs(+req.user.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@UseGuards(JwtAuthGuard)
|
||||||
|
@ApiBearerAuth()
|
||||||
|
@ApiOkResponse({ description: 'Successfully added score'})
|
||||||
|
@ApiUnauthorizedResponse({ description: 'Invalid token' })
|
||||||
|
@Get('me/score/:score')
|
||||||
|
addScore(
|
||||||
|
@Request() req: any,
|
||||||
|
@Param('id') score: number,
|
||||||
|
) {
|
||||||
|
return this.usersService.addScore(
|
||||||
|
+req.user.id,
|
||||||
|
score,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,9 +11,10 @@ export class ScoresController {
|
|||||||
constructor(private readonly scoresService: ScoresService) {}
|
constructor(private readonly scoresService: ScoresService) {}
|
||||||
|
|
||||||
|
|
||||||
@ApiOkResponse({ description: 'Successfully sent the Top 3 players'})
|
// @ApiOkResponse({ description: 'Successfully sent the Top 3 players'})
|
||||||
@Get('scores/top/3')
|
// @Get('scores/top/3')
|
||||||
getTopThree(): Promise<any> {
|
// getTopThree(): Promise<any> {
|
||||||
return await this.scoresService.topThree();
|
// // return await this.scoresService.topThree();
|
||||||
}
|
// return [] as any[];
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
@@ -7,8 +7,9 @@ export class ScoresService {
|
|||||||
private prisma: PrismaService,
|
private prisma: PrismaService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async topThree(): Promise<any> {
|
// // async topThree(): Promise<any> {
|
||||||
// return this.prisma.
|
// // return this.prisma.user.findMany(
|
||||||
return [];
|
// // // {orderBy: }
|
||||||
}
|
// // )
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user