diff --git a/back/prisma/schema.prisma b/back/prisma/schema.prisma index be1afc7..344fb4e 100644 --- a/back/prisma/schema.prisma +++ b/back/prisma/schema.prisma @@ -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[] diff --git a/back/src/auth/auth.controller.ts b/back/src/auth/auth.controller.ts index 83bdcb6..f977f69 100644 --- a/back/src/auth/auth.controller.ts +++ b/back/src/auth/auth.controller.ts @@ -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, + ); + } } diff --git a/back/src/scores/scores.controller.ts b/back/src/scores/scores.controller.ts index fcfa98f..0eeb175 100644 --- a/back/src/scores/scores.controller.ts +++ b/back/src/scores/scores.controller.ts @@ -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 { - return await this.scoresService.topThree(); - } + // @ApiOkResponse({ description: 'Successfully sent the Top 3 players'}) + // @Get('scores/top/3') + // getTopThree(): Promise { + // // return await this.scoresService.topThree(); + // return [] as any[]; + // } } \ No newline at end of file diff --git a/back/src/scores/scores.service.ts b/back/src/scores/scores.service.ts index a703263..6336fe7 100644 --- a/back/src/scores/scores.service.ts +++ b/back/src/scores/scores.service.ts @@ -7,8 +7,9 @@ export class ScoresService { private prisma: PrismaService, ) {} - async topThree(): Promise { - // return this.prisma. - return []; - } + // // async topThree(): Promise { + // // return this.prisma.user.findMany( + // // // {orderBy: } + // // ) + // } } \ No newline at end of file