front and back fix

This commit is contained in:
danis
2023-10-12 11:02:53 +02:00
parent 5c85296810
commit ab1ad17d21
6 changed files with 177 additions and 10181 deletions

10209
back/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -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();
}
}

View File

@@ -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,
});
}
}

View File

@@ -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,
},
},