add score controller
This commit is contained in:
@@ -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[]
|
||||
|
||||
@@ -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,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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[];
|
||||
// }
|
||||
}
|
||||
@@ -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: }
|
||||
// // )
|
||||
// }
|
||||
}
|
||||
Reference in New Issue
Block a user