Skip to content

Commit 910d486

Browse files
Merge branch 'development' of github.com:andrechristikan/ack-nestjs-boilerplate into development
2 parents 9ed1536 + 73cb0a6 commit 910d486

File tree

96 files changed

+1194
-568
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+1194
-568
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ Default response for the response
239239
export class ResponseDefaultSerialization {
240240
statusCode: number;
241241
message: string;
242-
metadata?: IResponseMetadata;
242+
_metadata?: IResponseMetadata;
243243
data?: Record<string, any>;
244244
}
245245
```
@@ -256,9 +256,9 @@ export class ResponsePagingSerialization {
256256
totalPage?: number;
257257
currentPage?: number;
258258
perPage?: number;
259-
availableSearch?: string[];
260-
availableSort?: string[];
261-
metadata?: IResponseMetadata;
259+
_availableSearch?: string[];
260+
_availableSort?: string[];
261+
_metadata?: IResponseMetadata;
262262
data: Record<string, any>[];
263263
}
264264

package.json

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ack-nestjs-boilerplate",
3-
"version": "4.1.4",
3+
"version": "4.2.3",
44
"description": "Ack NestJs Boilerplate",
55
"repository": {
66
"type": "git",
@@ -13,6 +13,7 @@
1313
"private": true,
1414
"license": "MIT",
1515
"scripts": {
16+
"upgrade:package": "ncu -u",
1617
"prebuild": "rimraf dist",
1718
"build": "nest build",
1819
"format": "yarn format:src && yarn format:test",
@@ -79,13 +80,13 @@
7980
"morgan": "^1.10.0",
8081
"nest-winston": "^1.8.0",
8182
"nestjs-command": "^3.1.3",
82-
"nestjs-i18n": "^10.2.4",
83+
"nestjs-i18n": "^10.2.6",
8384
"passport": "^0.6.0",
8485
"passport-headerapikey": "^1.2.2",
8586
"passport-jwt": "^4.0.1",
8687
"reflect-metadata": "^0.1.13",
8788
"response-time": "^2.3.2",
88-
"rimraf": "^3.0.2",
89+
"rimraf": "^4.0.4",
8990
"rotating-file-stream": "^3.0.4",
9091
"rxjs": "^7.8.0",
9192
"ua-parser-js": "^1.0.32",
@@ -116,17 +117,17 @@
116117
"@types/supertest": "^2.0.12",
117118
"@types/ua-parser-js": "^0.7.36",
118119
"@types/uuid": "^9.0.0",
119-
"@typescript-eslint/eslint-plugin": "^5.48.0",
120-
"@typescript-eslint/parser": "^5.48.0",
120+
"@typescript-eslint/eslint-plugin": "^5.48.1",
121+
"@typescript-eslint/parser": "^5.48.1",
121122
"cspell": "^6.18.1",
122123
"eslint": "^8.31.0",
123124
"eslint-config-prettier": "^8.6.0",
124-
"eslint-plugin-import": "^2.26.0",
125+
"eslint-plugin-import": "^2.27.4",
125126
"husky": "^8.0.3",
126127
"jest": "^29.3.1",
127-
"prettier": "^2.8.2",
128+
"prettier": "^2.8.3",
128129
"supertest": "^6.3.3",
129-
"ts-jest": "^29.0.3",
130+
"ts-jest": "^29.0.5",
130131
"ts-loader": "^9.4.2",
131132
"ts-node": "^10.9.1",
132133
"ts-prune": "^0.10.3",

src/app/controllers/app.controller.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export class AppController {
3535
const newDate = this.helperDateService.create();
3636

3737
return {
38-
metadata: {
38+
_metadata: {
3939
properties: {
4040
serviceName: this.serviceName,
4141
},
@@ -58,7 +58,7 @@ export class AppController {
5858
const newDate = this.helperDateService.create();
5959

6060
return {
61-
metadata: {
61+
_metadata: {
6262
properties: {
6363
serviceName: this.serviceName,
6464
},

src/common/api-key/controllers/api-key.admin.controller.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -92,26 +92,26 @@ export class ApiKeyAdminController {
9292
{
9393
page,
9494
perPage,
95-
sort,
96-
offset,
97-
search,
98-
availableSort,
99-
availableSearch,
95+
_sort,
96+
_offset,
97+
_search,
98+
_availableSort,
99+
_availableSearch,
100100
}: PaginationListDto,
101101
@PaginationQueryFilterInBoolean('isActive', API_KEY_DEFAULT_IS_ACTIVE)
102102
isActive: Record<string, any>
103103
): Promise<IResponsePaging> {
104104
const find: Record<string, any> = {
105-
...search,
105+
..._search,
106106
...isActive,
107107
};
108108

109109
const apiKeys: ApiKeyEntity[] = await this.apiKeyService.findAll(find, {
110110
paging: {
111111
limit: perPage,
112-
offset,
112+
offset: _offset,
113113
},
114-
sort,
114+
sort: _sort,
115115
});
116116
const totalData: number = await this.apiKeyService.getTotal(find);
117117
const totalPage: number = this.paginationService.totalPage(
@@ -124,8 +124,8 @@ export class ApiKeyAdminController {
124124
totalPage,
125125
currentPage: page,
126126
perPage,
127-
availableSearch,
128-
availableSort,
127+
_availableSearch,
128+
_availableSort,
129129
data: apiKeys,
130130
};
131131
}
@@ -165,7 +165,7 @@ export class ApiKeyAdminController {
165165
throw new InternalServerErrorException({
166166
statusCode: ENUM_ERROR_STATUS_CODE_ERROR.ERROR_UNKNOWN,
167167
message: 'http.serverError.internalServerError',
168-
error: err.message,
168+
_error: err.message,
169169
});
170170
}
171171
}
@@ -188,7 +188,7 @@ export class ApiKeyAdminController {
188188
throw new InternalServerErrorException({
189189
statusCode: ENUM_ERROR_STATUS_CODE_ERROR.ERROR_UNKNOWN,
190190
message: 'http.serverError.internalServerError',
191-
error: err.message,
191+
_error: err.message,
192192
});
193193
}
194194

@@ -213,7 +213,7 @@ export class ApiKeyAdminController {
213213
throw new InternalServerErrorException({
214214
statusCode: ENUM_ERROR_STATUS_CODE_ERROR.ERROR_UNKNOWN,
215215
message: 'http.serverError.internalServerError',
216-
error: err.message,
216+
_error: err.message,
217217
});
218218
}
219219

@@ -246,7 +246,7 @@ export class ApiKeyAdminController {
246246
throw new InternalServerErrorException({
247247
statusCode: ENUM_ERROR_STATUS_CODE_ERROR.ERROR_UNKNOWN,
248248
message: 'http.serverError.internalServerError',
249-
error: err.message,
249+
_error: err.message,
250250
});
251251
}
252252
}
@@ -271,7 +271,7 @@ export class ApiKeyAdminController {
271271
throw new InternalServerErrorException({
272272
statusCode: ENUM_ERROR_STATUS_CODE_ERROR.ERROR_UNKNOWN,
273273
message: 'http.serverError.internalServerError',
274-
error: err.message,
274+
_error: err.message,
275275
});
276276
}
277277

@@ -299,7 +299,7 @@ export class ApiKeyAdminController {
299299
throw new InternalServerErrorException({
300300
statusCode: ENUM_ERROR_STATUS_CODE_ERROR.ERROR_UNKNOWN,
301301
message: 'http.serverError.internalServerError',
302-
error: err.message,
302+
_error: err.message,
303303
});
304304
}
305305

src/common/api-key/docs/api-key.admin.doc.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ export function ApiKeyListDoc(): MethodDecorator {
2525
},
2626
response: {
2727
serialization: ApiKeyListSerialization,
28-
availableSort: API_KEY_DEFAULT_AVAILABLE_SORT,
29-
availableSearch: API_KEY_DEFAULT_AVAILABLE_SEARCH,
28+
_availableSort: API_KEY_DEFAULT_AVAILABLE_SORT,
29+
_availableSearch: API_KEY_DEFAULT_AVAILABLE_SEARCH,
3030
},
3131
})
3232
);

src/common/api-key/guards/x-api-key/api-key.x-api-key.guard.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
} from '@nestjs/common';
88
import { HelperNumberService } from 'src/common/helper/services/helper.number.service';
99
import { ENUM_API_KEY_STATUS_CODE_ERROR } from 'src/common/api-key/constants/api-key.status-code.constant';
10+
import { BadRequestError } from 'passport-headerapikey';
1011

1112
@Injectable()
1213
export class ApiKeyXApiKeyGuard extends AuthGuard('api-key') {
@@ -25,10 +26,8 @@ export class ApiKeyXApiKeyGuard extends AuthGuard('api-key') {
2526
): IApiKeyPayload {
2627
if (err || !apiKey) {
2728
if (
28-
(info instanceof Error &&
29-
info.name === 'BadRequestError' &&
30-
info.message === 'Missing API Key') ||
31-
!apiKey
29+
info instanceof BadRequestError &&
30+
info.message === 'Missing API Key'
3231
) {
3332
throw new UnauthorizedException({
3433
statusCode:

src/common/api-key/serializations/api-key.get.serialization.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,5 @@ export class ApiKeyGetSerialization {
5757
readonly updatedAt: Date;
5858

5959
@Exclude()
60-
readonly deletedAt: Date;
60+
readonly deletedAt?: Date;
6161
}

src/common/api-key/services/api-key.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,14 +223,14 @@ export class ApiKeyService implements IApiKeyService {
223223
_id: string,
224224
options?: IDatabaseSoftDeleteOptions
225225
): Promise<ApiKeyEntity> {
226-
return this.apiKeyRepository.deleteOneById(_id, options);
226+
return this.apiKeyRepository.softDeleteOneById(_id, options);
227227
}
228228

229229
async deleteOne(
230230
find: Record<string, any>,
231231
options?: IDatabaseSoftDeleteOptions
232232
): Promise<ApiKeyEntity> {
233-
return this.apiKeyRepository.deleteOne(find, options);
233+
return this.apiKeyRepository.softDeleteOne(find, options);
234234
}
235235

236236
async validateHashApiKey(

src/common/auth/constants/auth.enum.permission.constant.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export enum ENUM_AUTH_PERMISSIONS {
1212
USER_UPDATE = 'USER_UPDATE',
1313
USER_ACTIVE = 'USER_ACTIVE',
1414
USER_INACTIVE = 'USER_INACTIVE',
15+
USER_BLOCKED = 'USER_BLOCKED',
1516
USER_DELETE = 'USER_DELETE',
1617
USER_IMPORT = 'USER_IMPORT',
1718
USER_EXPORT = 'USER_EXPORT',

src/common/auth/guards/jwt-access/auth.jwt-access.guard.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export class AuthJwtAccessGuard extends AuthGuard('jwt') {
1010
statusCode:
1111
ENUM_AUTH_STATUS_CODE_ERROR.AUTH_JWT_ACCESS_TOKEN_ERROR,
1212
message: 'auth.error.accessTokenUnauthorized',
13-
error: err ? err.message : info.message,
13+
_error: err ? err.message : info.message,
1414
});
1515
}
1616

0 commit comments

Comments
 (0)