diff --git a/server/src/challenge-actions/challenge-actions.controller.ts b/server/src/challenge-actions/challenge-actions.controller.ts index 08324a1..c972202 100644 --- a/server/src/challenge-actions/challenge-actions.controller.ts +++ b/server/src/challenge-actions/challenge-actions.controller.ts @@ -1,7 +1,7 @@ import { Controller, Get, Post, Body, Patch, Param, Delete, ParseIntPipe, HttpCode, UseGuards, Req, Query, NotFoundException } from '@nestjs/common' import { ChallengeActionsService } from './challenge-actions.service' import { AuthenticatedRequest, JwtAuthGuard } from 'src/auth/jwt-auth.guard' -import { ApiBearerAuth, ApiCreatedResponse, ApiForbiddenResponse, ApiNotFoundResponse, ApiOkResponse, ApiUnauthorizedResponse } from '@nestjs/swagger' +import { ApiBearerAuth, ApiCreatedResponse, ApiNotFoundResponse, ApiOkResponse, ApiUnauthorizedResponse, ApiUnprocessableEntityResponse } from '@nestjs/swagger' import { ChallengeActionEntity } from './entities/challenge-action.entity' import { CreateChallengeActionDto } from './dto/create-challenge-action.dto' import { ApiOkResponsePaginated, paginateOutput } from 'src/common/utils/pagination.utils' @@ -21,7 +21,6 @@ export class ChallengeActionsController { @ApiBearerAuth() @ApiCreatedResponse({ type: ChallengeActionEntity, description: "Objet créé avec succès" }) @ApiUnauthorizedResponse({ description: "Non authentifié⋅e" }) - @ApiForbiddenResponse({ description: "Permission refusée" }) async create(@Req() request: AuthenticatedRequest, @Body() createChallengeActionDto: CreateChallengeActionDto): Promise { const challenge = await this.challengeActionsService.create(request.user, createChallengeActionDto) return new ChallengeActionEntity(challenge) @@ -32,7 +31,6 @@ export class ChallengeActionsController { @ApiBearerAuth() @ApiOkResponsePaginated(ChallengeActionEntity) @ApiUnauthorizedResponse({ description: "Non authentifié⋅e" }) - @ApiForbiddenResponse({ description: "Permission refusée" }) async findAll(@Query() queryPagination: QueryPaginationDto, @Query() filterChallengeActions: FilterChallengeActionsDto): Promise> { const [challengeActions, total] = await this.challengeActionsService.findAll(queryPagination, filterChallengeActions) return paginateOutput(challengeActions.map(challengeAction => new ChallengeActionEntity(challengeAction)), total, queryPagination) @@ -43,7 +41,6 @@ export class ChallengeActionsController { @ApiBearerAuth() @ApiOkResponse({ type: ChallengeActionEntity }) @ApiUnauthorizedResponse({ description: "Non authentifié⋅e" }) - @ApiForbiddenResponse({ description: "Permission refusée" }) @ApiNotFoundResponse({ description: "Objet non trouvé" }) async findOne(@Param('id', ParseIntPipe) id: number): Promise { const challenge = await this.challengeActionsService.findOne(id) @@ -57,7 +54,6 @@ export class ChallengeActionsController { @ApiBearerAuth() @ApiOkResponse({ type: ChallengeActionEntity }) @ApiUnauthorizedResponse({ description: "Non authentifié⋅e" }) - @ApiForbiddenResponse({ description: "Permission refusée" }) @ApiNotFoundResponse({ description: "Objet non trouvé" }) async update(@Param('id', ParseIntPipe) id: number, @Body() updateChallengeActionDto: UpdateChallengeActionDto) { return await this.challengeActionsService.update(id, updateChallengeActionDto) @@ -69,7 +65,6 @@ export class ChallengeActionsController { @ApiBearerAuth() @ApiOkResponse({ type: ChallengeActionEntity }) @ApiUnauthorizedResponse({ description: "Non authentifié⋅e" }) - @ApiForbiddenResponse({ description: "Permission refusée" }) @ApiNotFoundResponse({ description: "Objet non trouvé" }) async remove(@Param('id', ParseIntPipe) id: number) { await this.challengeActionsService.remove(id) @@ -80,7 +75,6 @@ export class ChallengeActionsController { @ApiBearerAuth() @ApiOkResponse({ type: ChallengeActionEntity }) @ApiUnauthorizedResponse({ description: "Non authentifié⋅e" }) - @ApiForbiddenResponse({ description: "Permission refusée" }) @ApiNotFoundResponse({ description: "Objet non trouvé" }) async endCurrent(@Req() request: AuthenticatedRequest, @Body() { success }: EndChallengeActionDto): Promise { const challengeAction = await this.challengeActionsService.endCurrentChallenge(request.user, success) diff --git a/server/src/geolocations/geolocations.controller.ts b/server/src/geolocations/geolocations.controller.ts index d2ce16a..0393526 100644 --- a/server/src/geolocations/geolocations.controller.ts +++ b/server/src/geolocations/geolocations.controller.ts @@ -2,7 +2,7 @@ import { Controller, Get, Post, Body, Patch, Param, Delete, ParseIntPipe, UseGua import { GeolocationsService } from './geolocations.service' import { CreateGeolocationDto } from './dto/create-geolocation.dto' import { AuthenticatedRequest, JwtAuthGuard } from 'src/auth/jwt-auth.guard' -import { ApiBearerAuth, ApiCreatedResponse, ApiForbiddenResponse, ApiNoContentResponse, ApiNotFoundResponse, ApiOkResponse, ApiUnauthorizedResponse } from '@nestjs/swagger' +import { ApiBearerAuth, ApiCreatedResponse, ApiNoContentResponse, ApiNotFoundResponse, ApiOkResponse, ApiUnauthorizedResponse } from '@nestjs/swagger' import { GeolocationEntity } from './entities/geolocation.entity' import { ApiOkResponsePaginated, paginateOutput } from 'src/common/utils/pagination.utils' import { QueryPaginationDto } from 'src/common/dto/pagination-query.dto' @@ -19,7 +19,6 @@ export class GeolocationsController { @ApiBearerAuth() @ApiCreatedResponse({ type: GeolocationEntity, description: "Objet créé avec succès" }) @ApiUnauthorizedResponse({ description: "Non authentifié⋅e" }) - @ApiForbiddenResponse({ description: "Permission refusée" }) async create(@Req() request: AuthenticatedRequest, @Body() createGeolocationDto: CreateGeolocationDto): Promise { const geolocation = await this.geolocationsService.create(request.user, createGeolocationDto) return new GeolocationEntity(geolocation) @@ -30,7 +29,6 @@ export class GeolocationsController { @ApiBearerAuth() @ApiOkResponsePaginated(GeolocationEntity) @ApiUnauthorizedResponse({ description: "Non authentifié⋅e" }) - @ApiForbiddenResponse({ description: "Permission refusée" }) async findAll(@Query() queryPagination?: QueryPaginationDto, @Query() playerFilter?: PlayerFilterDto): Promise> { const [geolocations, total] = await this.geolocationsService.findAll(queryPagination, playerFilter) return paginateOutput(geolocations.map(geolocation => new GeolocationEntity(geolocation)), total, queryPagination) @@ -41,7 +39,6 @@ export class GeolocationsController { @ApiBearerAuth() @ApiOkResponse({ type: GeolocationEntity }) @ApiUnauthorizedResponse({ description: "Non authentifié⋅e" }) - @ApiForbiddenResponse({ description: "Permission refusée" }) @ApiNotFoundResponse({ description: "Objet non trouvé" }) async findOne(@Param('id', ParseIntPipe) id: number): Promise { const geolocation = await this.geolocationsService.findOne(id) @@ -55,7 +52,6 @@ export class GeolocationsController { @ApiBearerAuth() @ApiOkResponse({ type: GeolocationEntity }) @ApiUnauthorizedResponse({ description: "Non authentifié⋅e" }) - @ApiForbiddenResponse({ description: "Permission refusée" }) @ApiNotFoundResponse({ description: "Aucune localisation trouvée" }) async findLastLocation(@Param('playerId', ParseIntPipe) playerId: number): Promise { const geolocation = await this.geolocationsService.findLastLocation(playerId) @@ -70,7 +66,6 @@ export class GeolocationsController { @ApiBearerAuth() @ApiNoContentResponse({ description: "Objet supprimé avec succès" }) @ApiUnauthorizedResponse({ description: "Non authentifié⋅e" }) - @ApiForbiddenResponse({ description: "Permission refusée" }) @ApiNotFoundResponse({ description: "Objet non trouvé" }) async remove(@Param('id', ParseIntPipe) id: number): Promise { await this.geolocationsService.remove(+id) diff --git a/server/src/money-updates/money-updates.controller.ts b/server/src/money-updates/money-updates.controller.ts index ea1adaa..79dcca8 100644 --- a/server/src/money-updates/money-updates.controller.ts +++ b/server/src/money-updates/money-updates.controller.ts @@ -3,7 +3,7 @@ import { MoneyUpdatesService } from './money-updates.service' import { CreateMoneyUpdateDto } from './dto/create-money-update.dto' import { UpdateMoneyUpdateDto } from './dto/update-money-update.dto' import { AuthenticatedRequest, JwtAuthGuard } from 'src/auth/jwt-auth.guard' -import { ApiBearerAuth, ApiCreatedResponse, ApiForbiddenResponse, ApiNotFoundResponse, ApiOkResponse, ApiUnauthorizedResponse } from '@nestjs/swagger' +import { ApiBearerAuth, ApiCreatedResponse, ApiNotFoundResponse, ApiOkResponse, ApiUnauthorizedResponse } from '@nestjs/swagger' import { MoneyUpdateEntity } from './entities/money-update.entity' import { ApiOkResponsePaginated, paginateOutput } from 'src/common/utils/pagination.utils' import { QueryPaginationDto } from 'src/common/dto/pagination-query.dto' @@ -20,7 +20,6 @@ export class MoneyUpdatesController { @ApiBearerAuth() @ApiCreatedResponse({ type: MoneyUpdateEntity, description: "Objet créé avec succès" }) @ApiUnauthorizedResponse({ description: "Non authentifié⋅e" }) - @ApiForbiddenResponse({ description: "Permission refusée" }) async create(@Req() request: AuthenticatedRequest, @Body() createMoneyUpdateDto: CreateMoneyUpdateDto): Promise { const moneyUpdate = await this.moneyUpdatesService.create(request.user, createMoneyUpdateDto) return new MoneyUpdateEntity(moneyUpdate) @@ -31,7 +30,6 @@ export class MoneyUpdatesController { @ApiBearerAuth() @ApiOkResponsePaginated(MoneyUpdateEntity) @ApiUnauthorizedResponse({ description: "Non authentifié⋅e" }) - @ApiForbiddenResponse({ description: "Permission refusée" }) async findAll(@Query() queryPagination: QueryPaginationDto, @Query() playerFilter: PlayerFilterDto): Promise> { const [trains, total] = await this.moneyUpdatesService.findAll(queryPagination, playerFilter) return paginateOutput(trains.map(train => new MoneyUpdateEntity(train)), total, queryPagination) @@ -42,7 +40,6 @@ export class MoneyUpdatesController { @ApiBearerAuth() @ApiOkResponse({ type: MoneyUpdateEntity }) @ApiUnauthorizedResponse({ description: "Non authentifié⋅e" }) - @ApiForbiddenResponse({ description: "Permission refusée" }) @ApiNotFoundResponse({ description: "Objet non trouvé" }) async findOne(@Param('id', ParseIntPipe) id: number): Promise { const train = await this.moneyUpdatesService.findOne(id) @@ -56,7 +53,6 @@ export class MoneyUpdatesController { @ApiBearerAuth() @ApiOkResponse({ type: MoneyUpdateEntity }) @ApiUnauthorizedResponse({ description: "Non authentifié⋅e" }) - @ApiForbiddenResponse({ description: "Permission refusée" }) @ApiNotFoundResponse({ description: "Objet non trouvé" }) async update(@Param('id', ParseIntPipe) id: number, @Body() updateMoneyUpdateDto: UpdateMoneyUpdateDto) { return await this.moneyUpdatesService.update(id, updateMoneyUpdateDto) @@ -68,7 +64,6 @@ export class MoneyUpdatesController { @ApiBearerAuth() @ApiOkResponse({ type: MoneyUpdateEntity }) @ApiUnauthorizedResponse({ description: "Non authentifié⋅e" }) - @ApiForbiddenResponse({ description: "Permission refusée" }) @ApiNotFoundResponse({ description: "Objet non trouvé" }) async remove(@Param('id', ParseIntPipe) id: number) { await this.moneyUpdatesService.remove(id) diff --git a/server/src/players/players.controller.ts b/server/src/players/players.controller.ts index a0a305f..70b8393 100644 --- a/server/src/players/players.controller.ts +++ b/server/src/players/players.controller.ts @@ -1,6 +1,6 @@ import { Body, Controller, Get, HttpCode, NotFoundException, Param, ParseIntPipe, Patch, Query, Req, UseGuards } from '@nestjs/common' import { PlayersService } from './players.service' -import { ApiBadRequestResponse, ApiBearerAuth, ApiForbiddenResponse, ApiNoContentResponse, ApiNotFoundResponse, ApiOkResponse, ApiUnauthorizedResponse } from '@nestjs/swagger' +import { ApiBadRequestResponse, ApiBearerAuth, ApiNoContentResponse, ApiNotFoundResponse, ApiOkResponse, ApiUnauthorizedResponse } from '@nestjs/swagger' import { PlayerEntity } from './entities/player.entity' import { AuthenticatedRequest, JwtAuthGuard } from 'src/auth/jwt-auth.guard' import { UpdatePasswordDto } from './dto/player_password.dto' @@ -17,7 +17,6 @@ export class PlayersController { @ApiBearerAuth() @ApiOkResponsePaginated(PlayerEntity) @ApiUnauthorizedResponse({ description: "Non authentifié⋅e" }) - @ApiForbiddenResponse({ description: "Permission refusée" }) async findAll(@Query() queryPagination?: QueryPaginationDto): Promise> { const [players, total] = await this.playersService.findAll(queryPagination) return paginateOutput(players.map(player => new PlayerEntity(player)), total, queryPagination) @@ -28,7 +27,6 @@ export class PlayersController { @ApiBearerAuth() @ApiOkResponse({ type: PlayerEntity }) @ApiUnauthorizedResponse({ description: "Non authentifié⋅e" }) - @ApiForbiddenResponse({ description: "Permission refusée" }) @ApiNotFoundResponse({ description: "Joueur⋅se non trouvé⋅e" }) async findOne(@Param('id', ParseIntPipe) id: number) { const player = await this.playersService.findOne(id) @@ -44,7 +42,6 @@ export class PlayersController { @ApiNoContentResponse({description: "Le mot de passe a bien été modifié."}) @ApiBadRequestResponse({description: "Erreur dans la saisie du nouveau mot de passe."}) @ApiUnauthorizedResponse({ description: "Non authentifié⋅e" }) - @ApiForbiddenResponse({ description: "Permission refusée" }) async updatePassword(@Req() request: AuthenticatedRequest, @Body() body: UpdatePasswordDto) { await this.playersService.updatePassword(request.user, body) } diff --git a/server/src/trains/trains.controller.ts b/server/src/trains/trains.controller.ts index 54de87f..8039c4c 100644 --- a/server/src/trains/trains.controller.ts +++ b/server/src/trains/trains.controller.ts @@ -4,7 +4,7 @@ import { CreateTrainDto } from './dto/create-train.dto' import { UpdateTrainDto } from './dto/update-train.dto' import { TrainEntity } from './entities/train.entity' import { AuthenticatedRequest, JwtAuthGuard } from 'src/auth/jwt-auth.guard' -import { ApiBearerAuth, ApiCreatedResponse, ApiForbiddenResponse, ApiNotFoundResponse, ApiOkResponse, ApiUnauthorizedResponse } from '@nestjs/swagger' +import { ApiBearerAuth, ApiCreatedResponse, ApiNotFoundResponse, ApiOkResponse, ApiUnauthorizedResponse } from '@nestjs/swagger' import { ApiOkResponsePaginated, paginateOutput } from 'src/common/utils/pagination.utils' import { QueryPaginationDto } from 'src/common/dto/pagination-query.dto' import { PaginateOutputDto } from 'src/common/dto/pagination-output.dto' @@ -21,7 +21,6 @@ export class TrainsController { @ApiBearerAuth() @ApiCreatedResponse({ type: TrainEntity, description: "Objet créé avec succès" }) @ApiUnauthorizedResponse({ description: "Non authentifié⋅e" }) - @ApiForbiddenResponse({ description: "Permission refusée" }) async create(@Body() createTrainDto: CreateTrainDto): Promise { const train = await this.trainsService.create(createTrainDto) return new TrainEntity(train) @@ -32,7 +31,6 @@ export class TrainsController { @ApiBearerAuth() @ApiOkResponsePaginated(TrainEntity) @ApiUnauthorizedResponse({ description: "Non authentifié⋅e" }) - @ApiForbiddenResponse({ description: "Permission refusée" }) async findAll(@Query() queryPagination: QueryPaginationDto, @Query() playerFilter: PlayerFilterDto): Promise> { const [trains, total] = await this.trainsService.findAll(queryPagination, playerFilter) return paginateOutput(trains.map(train => new TrainEntity(train)), total, queryPagination) @@ -43,7 +41,6 @@ export class TrainsController { @ApiBearerAuth() @ApiOkResponse({ type: TrainEntity }) @ApiUnauthorizedResponse({ description: "Non authentifié⋅e" }) - @ApiForbiddenResponse({ description: "Permission refusée" }) @ApiNotFoundResponse({ description: "Objet non trouvé" }) async findOne(@Param('id') id: string): Promise { const train = await this.trainsService.findOne(id) @@ -57,7 +54,6 @@ export class TrainsController { @ApiBearerAuth() @ApiOkResponse({ type: TrainEntity }) @ApiUnauthorizedResponse({ description: "Non authentifié⋅e" }) - @ApiForbiddenResponse({ description: "Permission refusée" }) @ApiNotFoundResponse({ description: "Objet non trouvé" }) async update(@Param('id') id: string, @Body() updateTrainDto: UpdateTrainDto) { return await this.trainsService.update(id, updateTrainDto) @@ -69,7 +65,6 @@ export class TrainsController { @ApiBearerAuth() @ApiOkResponse({ type: TrainEntity }) @ApiUnauthorizedResponse({ description: "Non authentifié⋅e" }) - @ApiForbiddenResponse({ description: "Permission refusée" }) @ApiNotFoundResponse({ description: "Objet non trouvé" }) async remove(@Param('id') id: string) { await this.trainsService.remove(id) @@ -81,7 +76,6 @@ export class TrainsController { @ApiBearerAuth() @ApiCreatedResponse({ type: TrainEntity, description: "Train importé avec succès" }) @ApiUnauthorizedResponse({ description: "Non authentifié⋅e" }) - @ApiForbiddenResponse({ description: "Permission refusée" }) async import(@Req() request: AuthenticatedRequest, @Body() importTrainDto: ImportTrainDto): Promise { const train = await this.trainsService.import(request.user, importTrainDto) return new TrainEntity(train)