-
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.
Merge pull request #760 from rocket-admin/backend_refactoring
Backend refactoring
- Loading branch information
Showing
36 changed files
with
134 additions
and
391 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
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,13 +1,12 @@ | ||
import { createParamDecorator, ExecutionContext } from '@nestjs/common'; | ||
import { BadRequestException, createParamDecorator, ExecutionContext } from '@nestjs/common'; | ||
import { IRequestWithCognitoInfo } from '../authorization/index.js'; | ||
import { Messages } from '../exceptions/text/messages.js'; | ||
import { buildBadRequestException } from '../guards/utils/index.js'; | ||
|
||
export const QueryTableName = createParamDecorator((data: unknown, ctx: ExecutionContext): string => { | ||
const request: IRequestWithCognitoInfo = ctx.switchToHttp().getRequest(); | ||
const query = request.query; | ||
if (query.hasOwnProperty('tableName') && query['tableName'].length > 0) { | ||
return query['tableName']; | ||
} | ||
throw buildBadRequestException(Messages.TABLE_NAME_MISSING); | ||
throw new BadRequestException(Messages.TABLE_NAME_MISSING); | ||
}); |
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
Empty file.
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,17 +1,16 @@ | ||
import { createParamDecorator, ExecutionContext } from '@nestjs/common'; | ||
import { BadRequestException, createParamDecorator, ExecutionContext } from '@nestjs/common'; | ||
import { IRequestWithCognitoInfo } from '../authorization/index.js'; | ||
import { Messages } from '../exceptions/text/messages.js'; | ||
import { buildBadRequestException } from '../guards/utils/index.js'; | ||
import { ValidationHelper } from '../helpers/validators/validation-helper.js'; | ||
|
||
export const UserId = createParamDecorator((data: any, ctx: ExecutionContext): string => { | ||
const request: IRequestWithCognitoInfo = ctx.switchToHttp().getRequest(); | ||
const userId = request.decoded?.sub; | ||
if (!userId) { | ||
throw buildBadRequestException(Messages.USER_ID_MISSING); | ||
throw new BadRequestException(Messages.USER_ID_MISSING); | ||
} | ||
if (ValidationHelper.isValidUUID(userId)) { | ||
return userId; | ||
} | ||
throw buildBadRequestException(Messages.UUID_INVALID); | ||
throw new BadRequestException(Messages.UUID_INVALID); | ||
}); |
4 changes: 2 additions & 2 deletions
4
backend/src/entities/group/application/data-sctructures/added-user-in-group.ds.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
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
182 changes: 0 additions & 182 deletions
182
backend/src/entities/group/use-cases/add-user-in-group.use.case.ts
This file was deleted.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
backend/src/entities/group/use-cases/delete-group.use.case.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
Oops, something went wrong.