front and back fix
This commit is contained in:
10209
back/package-lock.json
generated
10209
back/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -2,19 +2,19 @@ import {
|
||||
Controller,
|
||||
Get,
|
||||
} from '@nestjs/common';
|
||||
import { ApiTags } from '@nestjs/swagger';
|
||||
import { ApiOkResponse, ApiTags } from '@nestjs/swagger';
|
||||
import { ScoresService } from './scores.service';
|
||||
import { User } from '@prisma/client';
|
||||
|
||||
@ApiTags('scores')
|
||||
@Controller('scores')
|
||||
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();
|
||||
// return [] as any[];
|
||||
// }
|
||||
|
||||
@ApiOkResponse({ description: 'Successfully sent the Top 20 players'})
|
||||
@Get('scores/top/20')
|
||||
getTopTwenty(): Promise<User[]> {
|
||||
return this.scoresService.topTwenty();
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { User } from '@prisma/client';
|
||||
import { PrismaService } from 'src/prisma/prisma.service';
|
||||
|
||||
@Injectable()
|
||||
@@ -7,9 +8,12 @@ export class ScoresService {
|
||||
private prisma: PrismaService,
|
||||
) {}
|
||||
|
||||
// // async topThree(): Promise<any> {
|
||||
// // return this.prisma.user.findMany(
|
||||
// // // {orderBy: }
|
||||
// // )
|
||||
// }
|
||||
async topTwenty(): Promise<User[]> {
|
||||
return this.prisma.user.findMany({
|
||||
orderBy: {
|
||||
partyPlayed: 'desc',
|
||||
},
|
||||
take: 20,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -134,13 +134,13 @@ export class UsersService {
|
||||
}
|
||||
|
||||
async addScore(
|
||||
where: Prisma.UserWhereUniqueInput,
|
||||
where: number,
|
||||
score: number,
|
||||
) {
|
||||
return this.prisma.user.update({
|
||||
where,
|
||||
where: { id: where },
|
||||
data: {
|
||||
score: {
|
||||
partyPlayed: {
|
||||
increment: score,
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user