generated from xgeekshq/oss-template
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: regular board public private (#1093)
Co-authored-by: Cátia Antunes <c.antunes@kigroup.de>
- Loading branch information
1 parent
33b747d
commit 5168513
Showing
26 changed files
with
322 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export class LoginGuestUserResponse { | ||
board: string; | ||
user: string; | ||
} |
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
3 changes: 3 additions & 0 deletions
3
backend/src/modules/auth/interfaces/applications/register.auth.application.interface.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 |
---|---|---|
@@ -1,6 +1,9 @@ | ||
import { LoginGuestUserResponse } from './../../../../libs/dto/response/login-guest-user.response'; | ||
import CreateGuestUserDto from 'src/modules/users/dto/create.guest.user.dto'; | ||
import CreateUserDto from 'src/modules/users/dto/create.user.dto'; | ||
import User from 'src/modules/users/entities/user.schema'; | ||
|
||
export interface RegisterAuthApplication { | ||
register(registrationData: CreateUserDto): Promise<User>; | ||
createGuestUser(guestUserData: CreateGuestUserDto): Promise<LoginGuestUserResponse>; | ||
} |
4 changes: 4 additions & 0 deletions
4
backend/src/modules/auth/interfaces/services/register.auth.service.interface.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 |
---|---|---|
@@ -1,6 +1,10 @@ | ||
import { LoginGuestUserResponse } from './../../../../libs/dto/response/login-guest-user.response'; | ||
import CreateGuestUserDto from 'src/modules/users/dto/create.guest.user.dto'; | ||
import CreateUserDto from 'src/modules/users/dto/create.user.dto'; | ||
import User from 'src/modules/users/entities/user.schema'; | ||
|
||
export interface RegisterAuthService { | ||
register(registrationData: CreateUserDto): Promise<User>; | ||
createGuest(guestUserData: CreateGuestUserDto): Promise<LoginGuestUserResponse>; | ||
loginGuest(guestUserData: CreateGuestUserDto): Promise<LoginGuestUserResponse>; | ||
} |
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
69 changes: 69 additions & 0 deletions
69
backend/src/modules/boards/controller/public.boards.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,69 @@ | ||
import { UserParams } from './../../../libs/dto/param/user.param'; | ||
import { Controller, Get, Inject, Param, Query } from '@nestjs/common'; | ||
import { | ||
ApiBadRequestResponse, | ||
ApiInternalServerErrorResponse, | ||
ApiNotFoundResponse, | ||
ApiOkResponse, | ||
ApiOperation, | ||
ApiParam, | ||
ApiQuery, | ||
ApiTags | ||
} from '@nestjs/swagger'; | ||
import { BaseParam } from 'src/libs/dto/param/base.param'; | ||
import BoardDto from '../dto/board.dto'; | ||
import { GetBoardApplicationInterface } from '../interfaces/applications/get.board.application.interface'; | ||
import { TYPES } from '../interfaces/types'; | ||
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'; | ||
|
||
@ApiTags('Public Boards') | ||
@Controller('publicBoards') | ||
export default class PublicBoardsController { | ||
constructor( | ||
@Inject(TYPES.applications.GetBoardApplication) | ||
private getBoardApp: GetBoardApplicationInterface | ||
) {} | ||
|
||
@ApiOperation({ summary: 'Retrieve a boolean that checks if board is public' }) | ||
@ApiParam({ type: String, name: 'boardId', required: true }) | ||
@ApiOkResponse({ type: BoardDto, description: 'Public status retrieved successfully!' }) | ||
@ApiBadRequestResponse({ | ||
description: 'Bad Request', | ||
type: BadRequestResponse | ||
}) | ||
@ApiNotFoundResponse({ | ||
type: NotFoundResponse, | ||
description: 'Board not found!' | ||
}) | ||
@ApiInternalServerErrorResponse({ | ||
description: 'Internal Server Error', | ||
type: InternalServerErrorResponse | ||
}) | ||
@Get(':boardId/publicStatus') | ||
async getPublicStatus(@Param() { boardId }: BaseParam) { | ||
return await this.getBoardApp.isBoardPublic(boardId); | ||
} | ||
|
||
@ApiOperation({ summary: 'Retrieve one public board by id' }) | ||
@ApiParam({ type: String, name: 'boardId', required: true }) | ||
@ApiQuery({ type: String, name: 'userId', required: true }) | ||
@ApiOkResponse({ type: BoardDto, description: 'Board retrieved successfully!' }) | ||
@ApiBadRequestResponse({ | ||
description: 'Bad Request', | ||
type: BadRequestResponse | ||
}) | ||
@ApiNotFoundResponse({ | ||
type: NotFoundResponse, | ||
description: 'Board not found!' | ||
}) | ||
@ApiInternalServerErrorResponse({ | ||
description: 'Internal Server Error', | ||
type: InternalServerErrorResponse | ||
}) | ||
@Get(':boardId') | ||
async getBoard(@Param() { boardId }: BaseParam, @Query() { userId }: UserParams) { | ||
return await this.getBoardApp.getBoard(boardId, userId); | ||
} | ||
} |
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
Oops, something went wrong.