Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE]: Swagger Documentation #371

Merged
merged 58 commits into from
Aug 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
76bdd2d
feat: add initial swagger configuration
tutods Jul 19, 2022
4816db1
feat: start swagger documentation on auth module
tutods Jul 19, 2022
73a0741
feat: update dependencies
tutods Jul 19, 2022
85d1f3d
fix: dependencies
tutods Jul 19, 2022
3c8185a
feat: dependencies tests
tutods Jul 19, 2022
89b6f31
feat: start votes module documentation
tutods Jul 20, 2022
10c0ac5
feat: create socket id dto to use on swagger docs
tutods Jul 20, 2022
afa5a86
feat(swagger): add params and body decorators on votes
tutods Jul 20, 2022
89d5eab
feat(swagger): add decorators to user dtos
tutods Jul 20, 2022
e5f5efa
feat(swagger): add decorators to team dtos
tutods Jul 20, 2022
9aecdce
feat: add summary to team endpoints
tutods Jul 20, 2022
4a602c4
feat(swagger): add base errors responses
tutods Jul 20, 2022
ddf8440
feat(swagger): add tags on all controllers
tutods Jul 20, 2022
a98334b
feat(swagger): add description on team dto
tutods Jul 20, 2022
4804f8c
feat(swagger): update teams dtos
tutods Jul 20, 2022
e66bc1d
feat(swagger): add dto and params decorators to comments module
tutods Jul 20, 2022
cc478bc
fix: change post auth/updatepassword route to patch auth/password
geomarb Jul 20, 2022
722fef9
fix: change post auth/recoverPassword route to patch auth/password/reset
geomarb Jul 20, 2022
3cdc751
fix: change get auth/dashboardStatistics route to get auth/statistics
geomarb Jul 20, 2022
b14cc34
feat(swagger): add decorators to cards
tutods Jul 21, 2022
0203085
feat: change routes and req method for check email endpoint
geomarb Jul 21, 2022
f8efe2b
chore: move azure route to controller
geomarb Jul 21, 2022
93a9666
fix(frontend-backend): dependencies
dsousa12 Jul 21, 2022
19adc4e
feat(swagger): type board dto
dsousa12 Jul 21, 2022
414ebfa
feat(frontend): update azure and auth paths
dsousa12 Jul 22, 2022
59097f7
feat(swagger): add decorators do board dtos
dsousa12 Jul 22, 2022
c1a6b86
feat(swagger): azure endpoints
dsousa12 Jul 22, 2022
48d46c1
feat(swagger): auth module response decorators
dsousa12 Jul 22, 2022
b6979cd
feat(swagger): add response decorators and types to votes module
dsousa12 Jul 22, 2022
8e15d64
feat: change routes and req method for check email endpoint in fronte…
geomarb Jul 21, 2022
65b61c7
feat: add swagger to azure auth routes
geomarb Jul 21, 2022
c3b4723
fix: remove todo.md file
dsousa12 Jul 22, 2022
2a43e73
fix: go back to get method for auth/users/:email and auth/azure/users…
geomarb Jul 22, 2022
84c4a53
feat(swagger): add decorators to boards controller
dsousa12 Jul 25, 2022
558b8cb
feat(swagger): create forbidden error
dsousa12 Jul 25, 2022
c35d61e
feat(swagger): comments response decorators
dsousa12 Jul 25, 2022
0c16d59
[FIX]: Only show the board settings for the user that created the boa…
CatiaBarroco-xgeeks Jul 19, 2022
48bdc65
[FIX]: Board Settings (Pipeline Error) (#342)
CatiaBarroco-xgeeks Jul 19, 2022
20647f1
[FEATURE]: Optimistic Updates (#335)
dvpfran Jul 21, 2022
35aca23
[FIX]: frontend pipeline (#347)
dvpfran Jul 21, 2022
607f97c
[FEATURE]: Board Settings Permissions (#345)
dsousa12 Jul 22, 2022
7186bd4
feat(board-header): add team admins avatars (#364)
nunocaseiro Jul 24, 2022
44f426e
[BUG]: Main board says no sub-team as merged even though it has (#363)
dsousa12 Jul 24, 2022
3ffd41b
[BUG]: Sub team "merge into main board" typo (#354)
CatiaBarroco-xgeeks Jul 25, 2022
7c1e6bc
[FIX]: Tooltip Content (#359)
CatiaBarroco-xgeeks Jul 25, 2022
0d0e26a
feat(swagger): add errors decorators (403 and 404)
dsousa12 Jul 25, 2022
deed18c
feat(swagger): azure decorators and refactor
dsousa12 Jul 25, 2022
3dd5509
fix(swagger): remove 401 from errors responses
dsousa12 Jul 25, 2022
2226dc1
fix(swagger): spelling
dsousa12 Jul 25, 2022
aa399aa
fix(swagger): card creation decorators
dsousa12 Jul 25, 2022
f6be8bc
fix(swagger): card creation decorators
dsousa12 Jul 25, 2022
0b1c44a
fix: pr conflicts
dsousa12 Jul 28, 2022
4eb0a97
Update backend/src/modules/cards/controller/cards.controller.ts
dsousa12 Aug 2, 2022
96e6dc5
Update backend/src/app.module.ts
dsousa12 Aug 2, 2022
1c82781
fix: pr conflicts
dsousa12 Aug 2, 2022
9908fa7
chore(backend): pr suggestions
dsousa12 Aug 2, 2022
c9b37cf
chore(frontend): pr suggestions
dsousa12 Aug 2, 2022
1df5b4a
fix: dependencies
dsousa12 Aug 2, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6,631 changes: 2,933 additions & 3,698 deletions backend/package-lock.json

Large diffs are not rendered by default.

49 changes: 26 additions & 23 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,52 +23,55 @@
"pre-commit": "lint-staged"
},
"dependencies": {
"@faker-js/faker": "^6.1.2",
"@nestjs-modules/mailer": "^1.6.1",
"@nestjs/common": "^8.4.4",
"@faker-js/faker": "^7.3.0",
"@nestjs-modules/mailer": "^1.8.1",
"@nestjs/common": "^9.0.0",
"@nestjs/config": "^2.0.0",
"@nestjs/core": "^8.4.4",
"@nestjs/jwt": "^8.0.0",
"@nestjs/core": "^9.0.0",
"@nestjs/jwt": "^9.0.0",
"@nestjs/mapped-types": "^1.0.1",
"@nestjs/mongoose": "^9.0.3",
"@nestjs/passport": "^8.2.1",
"@nestjs/platform-express": "^8.4.4",
"@nestjs/platform-socket.io": "^8.4.4",
"@nestjs/schedule": "^1.1.0",
"@nestjs/websockets": "^8.4.4",
"@slack/web-api": "^6.7.1",
"axios": "^0.26.1",
"@nestjs/passport": "^9.0.0",
"@nestjs/platform-express": "^9.0.0",
"@nestjs/platform-socket.io": "^9.0.0",
"@nestjs/schedule": "^2.1.0",
"@nestjs/swagger": "^6.0.4",
"@nestjs/websockets": "^9.0.0",
"@slack/web-api": "^6.7.1",
"axios": "^0.27.2",
"bcrypt": "^5.0.1",
"class-transformer": "^0.5.1",
"class-validator": "^0.13.2",
"cron": "1.8.2",
"cron": "2.1.0",
"dotenv": "^16.0.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-airbnb-typescript": "^17.0.0",
"express": "^4.17.3",
"joi": "^17.6.0",
"jwt-decode": "^3.1.2",
"lint-staged": "^12.3.7",
"lint-staged": "^13.0.3",
"moment": "^2.29.4",
"moment-business-days": "^1.2.0",
"mongodb": "4.5.0",
"mongoose": "6.2.10",
"mongoose-lean-virtuals": "0.9.0",
"nodemailer": "^6.7.5",
"passport": "^0.5.2",
"passport": "^0.6.0",
"passport-jwt": "^4.0.0",
"passport-local": "^1.0.0",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2",
"rxjs": "^7.5.6",
"socket.io": "^4.4.1"
"socket.io": "^4.4.1",
"swagger-ui-express": "^4.5.0"
},
"devDependencies": {
"@nestjs/cli": "^8.2.5",
"@nestjs/schematics": "^8.0.10",
"@nestjs/testing": "^8.4.4",
"@nestjs/cli": "^9.0.0",
"@nestjs/schematics": "^9.0.1",
"@nestjs/testing": "^9.0.0",
"@types/bcrypt": "^5.0.0",
"@types/express": "^4.17.13",
"@types/jest": "^27.4.1",
"@types/jest": "^28.1.6",
"@types/node": "^17.0.23",
"@types/passport-jwt": "^3.0.6",
"@types/passport-local": "^1.0.34",
Expand All @@ -84,14 +87,14 @@
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-simple-import-sort": "^7.0.0",
"eslint-plugin-unused-imports": "^2.0.0",
"jest": "^27.5.1",
"jest": "^28.1.3",
"prettier": "^2.6.2",
"source-map-support": "^0.5.21",
"supertest": "^6.2.2",
"ts-jest": "^27.1.4",
"ts-jest": "^28.0.7",
"ts-loader": "^9.2.8",
"ts-node": "^10.7.0",
"tsconfig-paths": "^3.14.1",
"tsconfig-paths": "^4.0.0",
"typescript": "^4.6.3"
},
"lint-staged": {
Expand Down
29 changes: 14 additions & 15 deletions backend/src/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
import { Module } from '@nestjs/common';
import { ScheduleModule } from '@nestjs/schedule';

import AppConfigModule from 'infrastructure/config/config.module';
import { configuration } from 'infrastructure/config/configuration';
import DatabaseModule from 'infrastructure/database/database.module';
import { mongooseResetModule, mongooseUserModule } from 'infrastructure/database/mongoose.module';
import AuthModule from 'modules/auth/auth.module';
import AzureModule from 'modules/azure/azure.module';
import BoardsModule from 'modules/boards/boards.module';
import { CardsModule } from 'modules/cards/cards.module';
import { CommentsModule } from 'modules/comments/comments.module';
import { CommunicationModule } from 'modules/communication/communication.module';

import AppConfigModule from './infrastructure/config/config.module';
import { configuration } from './infrastructure/config/configuration';
import DatabaseModule from './infrastructure/database/database.module';
import { mongooseResetModule, mongooseUserModule } from './infrastructure/database/mongoose.module';
import AuthModule from './modules/auth/auth.module';
import AzureModule from './modules/azure/azure.module';
import BoardsModule from './modules/boards/boards.module';
import { CardsModule } from './modules/cards/cards.module';
import { CommentsModule } from './modules/comments/comments.module';
import EmailModule from './modules/mailer/mailer.module';
import SocketModule from './modules/socket/socket.module';
import TeamsModule from './modules/teams/teams.module';
import UsersModule from './modules/users/users.module';
import { VotesModule } from './modules/votes/votes.module';
import EmailModule from 'modules/mailer/mailer.module';
import SocketModule from 'modules/socket/socket.module';
import TeamsModule from 'modules/teams/teams.module';
import UsersModule from 'modules/users/users.module';
import { VotesModule } from 'modules/votes/votes.module';

const imports = [
AppConfigModule,
Expand Down
2 changes: 2 additions & 0 deletions backend/src/libs/dto/base.dto.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { ApiProperty } from '@nestjs/swagger';
import { IsNotEmpty, IsString } from 'class-validator';

export class BaseDto {
@ApiProperty()
@IsNotEmpty()
@IsString()
socketId!: string;
Expand Down
2 changes: 2 additions & 0 deletions backend/src/libs/dto/param/email.param.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { ApiProperty } from '@nestjs/swagger';
import { IsEmail, IsString } from 'class-validator';

export class EmailParam {
@ApiProperty({ type: String, format: 'email' })
@IsEmail()
@IsString()
email!: string;
Expand Down
2 changes: 2 additions & 0 deletions backend/src/libs/dto/text.dto.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { ApiProperty } from '@nestjs/swagger';
import { Transform, TransformFnParams } from 'class-transformer';
import { IsNotEmpty, IsString } from 'class-validator';

import { BaseDto } from './base.dto';

export class TextDto extends BaseDto {
@ApiProperty()
@IsNotEmpty()
@IsString()
@Transform(({ value }: TransformFnParams) => value.trim())
Expand Down
53 changes: 38 additions & 15 deletions backend/src/libs/exceptions/messages.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,43 @@
export const USER_NOT_FOUND = 'USER_NOT_FOUND';
export const INVALID_CREDENTIALS = 'INVALID_CREDENTIALS';
const USER_NOT_FOUND = 'USER_NOT_FOUND';
const INVALID_CREDENTIALS = 'INVALID_CREDENTIALS';

export const EMAIL_EXISTS = 'EMAIL_EXISTS';
export const EMAIL_NOT_EXISTS = 'EMAIL_NOT_EXISTS';
export const EMAIL_DONT_MATCH = 'EMAIL_DONT_MATCH';
const EMAIL_EXISTS = 'EMAIL_EXISTS';
const EMAIL_NOT_EXISTS = 'EMAIL_NOT_EXISTS';
const EMAIL_DONT_MATCH = 'EMAIL_DONT_MATCH';

export const BOARD_NOT_FOUND = 'BOARD_NOT_FOUND';
export const BOARDS_NOT_FOUND = 'BOARDS_NOT_FOUND';
const BOARD_NOT_FOUND = 'BOARD_NOT_FOUND';
const BOARDS_NOT_FOUND = 'BOARDS_NOT_FOUND';

export const TOKENS_NOT_MATCHING = 'TOKENS_NOT_MATCHING';
const TOKENS_NOT_MATCHING = 'TOKENS_NOT_MATCHING';

export const UNAUTHORIZED = 'UNAUTHORIZED';
export const UPDATE_FAILED = 'UPDATE_FAILED';
export const DELETE_FAILED = 'DELETE_FAILED';
export const INSERT_FAILED = 'INSERT_FAILED';
const UNAUTHORIZED = 'UNAUTHORIZED';
const UPDATE_FAILED = 'UPDATE_FAILED';
const DELETE_FAILED = 'DELETE_FAILED';
const INSERT_FAILED = 'INSERT_FAILED';

export const CARD_NOT_REMOVED = "Card wasn't removed";
export const CARD_NOT_INSERTED = "Card wasn't inserted";
export const CARD_NOT_FOUND = "Card wasn't found";
const CARD_NOT_REMOVED = "Card wasn't removed";
const CARD_NOT_INSERTED = "Card wasn't inserted";
const CARD_NOT_FOUND = "Card wasn't found";

const FORBIDDEN = 'FORBIDDEN';
const NOT_FOUND = 'NOT_FOUND';

export {
BOARD_NOT_FOUND,
BOARDS_NOT_FOUND,
CARD_NOT_FOUND,
CARD_NOT_INSERTED,
CARD_NOT_REMOVED,
DELETE_FAILED,
EMAIL_DONT_MATCH,
EMAIL_EXISTS,
EMAIL_NOT_EXISTS,
FORBIDDEN,
INSERT_FAILED,
INVALID_CREDENTIALS,
NOT_FOUND,
TOKENS_NOT_MATCHING,
UNAUTHORIZED,
UPDATE_FAILED,
USER_NOT_FOUND
};
dsousa12 marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 6 additions & 0 deletions backend/src/libs/swagger/dto/socket-id.swagger.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { ApiProperty } from '@nestjs/swagger';

export class SocketIdDto {
@ApiProperty()
socketId!: string;
}
27 changes: 27 additions & 0 deletions backend/src/libs/swagger/errors/bad-request.swagger.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { ApiProperty } from '@nestjs/swagger';

import {
DELETE_FAILED,
EMAIL_DONT_MATCH,
EMAIL_EXISTS,
INSERT_FAILED,
UPDATE_FAILED
} from 'libs/exceptions/messages';

export class BadRequestResponse {
@ApiProperty({
type: Number,
default: 400
})
statusCode!: number;

@ApiProperty({
type: String,
isArray: true,
examples: [INSERT_FAILED, DELETE_FAILED, UPDATE_FAILED, EMAIL_EXISTS, EMAIL_DONT_MATCH]
})
message!: string[];

@ApiProperty({ type: String, default: 'Bad Request' })
error!: string;
}
21 changes: 21 additions & 0 deletions backend/src/libs/swagger/errors/forbidden.swagger.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { ApiProperty } from '@nestjs/swagger';

import { FORBIDDEN } from 'libs/exceptions/messages';

export class ForbiddenResponse {
@ApiProperty({
type: Number,
default: 403
})
statusCode!: number;

@ApiProperty({
type: String,
isArray: true,
default: [FORBIDDEN]
})
message!: string[];

@ApiProperty({ type: String, default: 'Forbidden' })
error!: string;
}
15 changes: 15 additions & 0 deletions backend/src/libs/swagger/errors/internal-server-error.swagger.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { ApiProperty } from '@nestjs/swagger';

export class InternalServerErrorResponse {
@ApiProperty({
type: Number,
default: 500
})
statusCode!: number;

@ApiProperty({
type: String,
default: 'Internal server error'
})
message!: string;
}
26 changes: 26 additions & 0 deletions backend/src/libs/swagger/errors/not-found.swagger.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { ApiProperty } from '@nestjs/swagger';

import {
BOARD_NOT_FOUND,
BOARDS_NOT_FOUND,
NOT_FOUND,
USER_NOT_FOUND
} from 'libs/exceptions/messages';

export class NotFoundResponse {
@ApiProperty({
type: Number,
default: 404
})
statusCode!: number;

@ApiProperty({
type: String,
isArray: true,
examples: [NOT_FOUND, BOARDS_NOT_FOUND, BOARD_NOT_FOUND, USER_NOT_FOUND]
})
message!: string[];

@ApiProperty({ type: String, default: 'Not Found' })
error!: string;
}
20 changes: 20 additions & 0 deletions backend/src/libs/swagger/errors/unauthorized.swagger.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';

export class UnauthorizedResponse {
@ApiProperty({
type: Number,
default: 401
})
statusCode!: number;

@ApiProperty({
type: String,
default: 'Unauthorized'
})
message!: string;

@ApiPropertyOptional({
type: String
})
error!: string;
}
Loading