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