add score controller

This commit is contained in:
danis
2023-10-08 20:54:45 +02:00
parent a0ca945c72
commit 0473665bb4
4 changed files with 27 additions and 9 deletions
+1
View File
@@ -24,6 +24,7 @@ model User {
googleID String? @unique
isGuest Boolean @default(false)
partyPlayed Int @default(0)
totalScore Int @default(0)
LessonHistory LessonHistory[]
SongHistory SongHistory[]
searchHistory SearchHistory[]
+15
View File
@@ -294,4 +294,19 @@ export class AuthController {
) {
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,
);
}
}
+6 -5
View File
@@ -11,9 +11,10 @@ export class ScoresController {
constructor(private readonly scoresService: ScoresService) {}
@ApiOkResponse({ description: 'Successfully sent the Top 3 players'})
@Get('scores/top/3')
getTopThree(): Promise<any> {
return await this.scoresService.topThree();
}
// @ApiOkResponse({ description: 'Successfully sent the Top 3 players'})
// @Get('scores/top/3')
// getTopThree(): Promise<any> {
// // return await this.scoresService.topThree();
// return [] as any[];
// }
}
+5 -4
View File
@@ -7,8 +7,9 @@ export class ScoresService {
private prisma: PrismaService,
) {}
async topThree(): Promise<any> {
// return this.prisma.
return [];
}
// // async topThree(): Promise<any> {
// // return this.prisma.user.findMany(
// // // {orderBy: }
// // )
// }
}