Skip to content

Commit 171bb9e

Browse files
resolve conflict
2 parents 1d787bf + 34ba64c commit 171bb9e

37 files changed

+220
-207
lines changed

package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ack-nestjs-boilerplate-kafka",
3-
"version": "3.2.5",
3+
"version": "3.3.0",
44
"description": "Ack NestJs Boilerplate Kafka",
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",
@@ -77,7 +78,7 @@
7778
"morgan": "^1.10.0",
7879
"nest-winston": "^1.8.0",
7980
"nestjs-command": "^3.1.3",
80-
"nestjs-i18n": "^10.2.4",
81+
"nestjs-i18n": "^10.2.5",
8182
"passport": "^0.6.0",
8283
"passport-headerapikey": "^1.2.2",
8384
"passport-jwt": "^4.0.1",
@@ -114,17 +115,17 @@
114115
"@types/supertest": "^2.0.12",
115116
"@types/ua-parser-js": "^0.7.36",
116117
"@types/uuid": "^9.0.0",
117-
"@typescript-eslint/eslint-plugin": "^5.48.0",
118-
"@typescript-eslint/parser": "^5.48.0",
118+
"@typescript-eslint/eslint-plugin": "^5.48.1",
119+
"@typescript-eslint/parser": "^5.48.1",
119120
"cspell": "^6.18.1",
120121
"eslint": "^8.31.0",
121122
"eslint-config-prettier": "^8.6.0",
122-
"eslint-plugin-import": "^2.26.0",
123+
"eslint-plugin-import": "^2.27.4",
123124
"husky": "^8.0.3",
124125
"jest": "^29.3.1",
125126
"prettier": "^2.8.2",
126127
"supertest": "^6.3.3",
127-
"ts-jest": "^29.0.3",
128+
"ts-jest": "^29.0.4",
128129
"ts-loader": "^9.4.2",
129130
"ts-node": "^10.9.1",
130131
"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/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

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

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

src/common/database/decorators/database.decorator.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ import {
1313
export function DatabaseConnection(
1414
connectionName?: string
1515
): ParameterDecorator {
16-
return InjectConnection(connectionName || DATABASE_CONNECTION_NAME);
16+
return InjectConnection(connectionName ?? DATABASE_CONNECTION_NAME);
1717
}
1818

1919
export function DatabaseModel(
2020
entity: any,
2121
connectionName?: string
2222
): ParameterDecorator {
23-
return InjectModel(entity, connectionName || DATABASE_CONNECTION_NAME);
23+
return InjectModel(entity, connectionName ?? DATABASE_CONNECTION_NAME);
2424
}
2525

2626
export function DatabaseEntity(options?: SchemaOptions): ClassDecorator {

src/common/doc/decorators/doc.decorator.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -432,11 +432,11 @@ export function DocPaging<T>(
432432
$ref: getSchemaPath(options.response.serialization),
433433
},
434434
},
435-
availableSearch: {
436-
example: options.response.availableSearch,
435+
_availableSearch: {
436+
example: options.response._availableSearch,
437437
},
438-
availableSort: {
439-
example: options.response.availableSort,
438+
_availableSort: {
439+
example: options.response._availableSort,
440440
},
441441
},
442442
},
@@ -447,7 +447,7 @@ export function DocPaging<T>(
447447
allowEmptyValue: true,
448448
type: 'string',
449449
description:
450-
'Search will base on availableSearch with rule contains, and case insensitive',
450+
'Search will base on _availableSearch with rule contains, and case insensitive',
451451
}),
452452
ApiQuery({
453453
name: 'perPage',
@@ -466,12 +466,13 @@ export function DocPaging<T>(
466466
description: 'page number',
467467
}),
468468
ApiQuery({
469-
name: 'sort',
469+
name: '_sort',
470470
required: true,
471471
allowEmptyValue: false,
472472
example: 'createdAt@desc',
473473
type: 'string',
474-
description: 'Sort base on availableSort, type is `asc` and `desc`',
474+
description:
475+
'Sort base on _availableSort, type is `asc` and `desc`',
475476
}),
476477

477478
// default
@@ -563,7 +564,7 @@ export function DocOneOf<T>(
563564
},
564565
statusCode: {
565566
type: 'number',
566-
example: doc.statusCode || HttpStatus.OK,
567+
example: doc.statusCode ?? HttpStatus.OK,
567568
},
568569
},
569570
};
@@ -609,7 +610,7 @@ export function DocAnyOf<T>(
609610
},
610611
statusCode: {
611612
type: 'number',
612-
example: doc.statusCode || HttpStatus.OK,
613+
example: doc.statusCode ?? HttpStatus.OK,
613614
},
614615
},
615616
};
@@ -655,7 +656,7 @@ export function DocAllOf<T>(
655656
},
656657
statusCode: {
657658
type: 'number',
658-
example: doc.statusCode || HttpStatus.OK,
659+
example: doc.statusCode ?? HttpStatus.OK,
659660
},
660661
},
661662
};

src/common/doc/interfaces/doc.interface.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ export interface IDocResponseOptions<T> {
4242
export interface IDocPagingResponseOptions<T>
4343
extends Pick<IDocResponseOptions<T>, 'statusCode'> {
4444
serialization: ClassConstructor<T>;
45-
availableSearch: string[];
46-
availableSort: string[];
45+
_availableSearch: string[];
46+
_availableSort: string[];
4747
}
4848

4949
export interface IDocAuthOptions {

0 commit comments

Comments
 (0)