generated from xgeekshq/oss-template
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: redirect guest user on public board (#1304)
- Loading branch information
1 parent
2061c92
commit b3f2516
Showing
11 changed files
with
98 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
backend/src/modules/boards/controller/publicBoards.controller.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { BaseParam } from 'src/libs/dto/param/base.param'; | ||
import { BadRequestResponse } from 'src/libs/swagger/errors/bad-request.swagger'; | ||
import { InternalServerErrorResponse } from 'src/libs/swagger/errors/internal-server-error.swagger'; | ||
import { NotFoundResponse } from 'src/libs/swagger/errors/not-found.swagger'; | ||
import { Controller, Get, Inject, Param } from '@nestjs/common'; | ||
import { | ||
ApiBadRequestResponse, | ||
ApiInternalServerErrorResponse, | ||
ApiNotFoundResponse, | ||
ApiOperation, | ||
ApiParam, | ||
ApiTags | ||
} from '@nestjs/swagger'; | ||
import { GetBoardApplicationInterface } from '../interfaces/applications/get.board.application.interface'; | ||
import { TYPES } from '../interfaces/types'; | ||
|
||
@ApiTags('PublicBoards') | ||
@Controller('publicBoards') | ||
export default class PublicBoardsController { | ||
constructor( | ||
@Inject(TYPES.applications.GetBoardApplication) | ||
private getBoardApp: GetBoardApplicationInterface | ||
) {} | ||
|
||
@ApiOperation({ summary: 'Check if board is public' }) | ||
@ApiParam({ type: String, name: 'boardId', required: true }) | ||
@ApiBadRequestResponse({ | ||
description: 'Bad Request', | ||
type: BadRequestResponse | ||
}) | ||
@ApiNotFoundResponse({ | ||
type: NotFoundResponse, | ||
description: 'Board not found!' | ||
}) | ||
@ApiInternalServerErrorResponse({ | ||
description: 'Internal Server Error', | ||
type: InternalServerErrorResponse | ||
}) | ||
@Get(':boardId/isPublic') | ||
getBoard(@Param() { boardId }: BaseParam) { | ||
return this.getBoardApp.isBoardPublic(boardId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters