Skip to content

Commit 0efbf8a

Browse files
resolve conflict
2 parents e06ef13 + 0f20afd commit 0efbf8a

File tree

12 files changed

+64
-78
lines changed

12 files changed

+64
-78
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ack-nestjs-boilerplate-kafka",
3-
"version": "3.2.1",
3+
"version": "3.2.2",
44
"description": "Ack NestJs Boilerplate Kafka",
55
"repository": {
66
"type": "git",

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export function ApiKeyListDoc(): MethodDecorator {
1818
DocPaging<ApiKeyListSerialization>('apiKey.list', {
1919
auth: {
2020
jwtAccessToken: true,
21+
permissionToken: true,
2122
},
2223
request: {
2324
queries: ApiKeyDocQueryIsActive,
@@ -36,6 +37,7 @@ export function ApiKeyGetDoc(): MethodDecorator {
3637
Doc<ApiKeyGetSerialization>('apiKey.get', {
3738
auth: {
3839
jwtAccessToken: true,
40+
permissionToken: true,
3941
},
4042
request: {
4143
params: ApiKeyDocParamsGet,
@@ -50,6 +52,7 @@ export function ApiKeyCreateDoc(): MethodDecorator {
5052
Doc<ApiKeyCreateSerialization>('apiKey.create', {
5153
auth: {
5254
jwtAccessToken: true,
55+
permissionToken: true,
5356
},
5457
response: {
5558
httpStatus: HttpStatus.CREATED,
@@ -64,6 +67,7 @@ export function ApiKeyActiveDoc(): MethodDecorator {
6467
Doc<void>('apiKey.active', {
6568
auth: {
6669
jwtAccessToken: true,
70+
permissionToken: true,
6771
},
6872
request: {
6973
params: ApiKeyDocParamsGet,
@@ -77,6 +81,7 @@ export function ApiKeyInactiveDoc(): MethodDecorator {
7781
Doc<void>('apiKey.inactive', {
7882
auth: {
7983
jwtAccessToken: true,
84+
permissionToken: true,
8085
},
8186
request: {
8287
params: ApiKeyDocParamsGet,
@@ -90,6 +95,7 @@ export function ApiKeyResetDoc(): MethodDecorator {
9095
Doc<void>('apiKey.reset', {
9196
auth: {
9297
jwtAccessToken: true,
98+
permissionToken: true,
9399
},
94100
request: {
95101
params: ApiKeyDocParamsGet,
@@ -106,6 +112,7 @@ export function ApiKeyUpdateDoc(): MethodDecorator {
106112
Doc<ResponseIdSerialization>('apiKey.update', {
107113
auth: {
108114
jwtAccessToken: true,
115+
permissionToken: true,
109116
},
110117
request: {
111118
params: ApiKeyDocParamsGet,

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

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,6 @@ export enum ENUM_AUTH_PERMISSIONS {
77
API_KEY_RESET = 'API_KEY_RESET',
88
API_KEY_UPDATE_DATE = 'API_KEY_UPDATE_DATE',
99

10-
USER_READ = 'USER_READ',
11-
USER_CREATE = 'USER_CREATE',
12-
USER_UPDATE = 'USER_UPDATE',
13-
USER_ACTIVE = 'USER_ACTIVE',
14-
USER_INACTIVE = 'USER_INACTIVE',
15-
USER_DELETE = 'USER_DELETE',
16-
USER_IMPORT = 'USER_IMPORT',
17-
USER_EXPORT = 'USER_EXPORT',
18-
19-
ROLE_CREATE = 'ROLE_CREATE',
20-
ROLE_UPDATE = 'ROLE_UPDATE',
21-
ROLE_ACTIVE = 'ROLE_ACTIVE',
22-
ROLE_INACTIVE = 'ROLE_INACTIVE',
23-
ROLE_READ = 'ROLE_READ',
24-
ROLE_DELETE = 'ROLE_DELETE',
25-
26-
PERMISSION_READ = 'PERMISSION_READ',
27-
PERMISSION_UPDATE = 'PERMISSION_UPDATE',
28-
PERMISSION_ACTIVE = 'PERMISSION_ACTIVE',
29-
PERMISSION_INACTIVE = 'PERMISSION_INACTIVE',
30-
3110
SETTING_READ = 'SETTING_READ',
3211
SETTING_UPDATE = 'SETTING_UPDATE',
3312
}

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

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
ApiProduces,
1111
ApiQuery,
1212
ApiResponse,
13+
ApiSecurity,
1314
getSchemaPath,
1415
} from '@nestjs/swagger';
1516
import { APP_LANGUAGE } from 'src/app/constants/app.constant';
@@ -130,7 +131,7 @@ export function Doc<T>(
130131
}
131132

132133
if (options?.auth?.apiKey) {
133-
auths.push(ApiBearerAuth('apiKey'));
134+
auths.push(ApiSecurity('apiKey'));
134135
oneOfUnauthorized.push(
135136
{
136137
statusCode: ENUM_API_KEY_STATUS_CODE_ERROR.API_KEY_NEEDED_ERROR,
@@ -154,6 +155,27 @@ export function Doc<T>(
154155
);
155156
}
156157

158+
if (options?.auth?.permissionToken) {
159+
auths.push(ApiSecurity('permissionToken'));
160+
oneOfUnauthorized.push(
161+
{
162+
statusCode:
163+
ENUM_AUTH_STATUS_CODE_ERROR.AUTH_PERMISSION_TOKEN_ERROR,
164+
messagePath: 'auth.error.permissionTokenUnauthorized',
165+
},
166+
{
167+
statusCode:
168+
ENUM_AUTH_STATUS_CODE_ERROR.AUTH_PERMISSION_TOKEN_INVALID_ERROR,
169+
messagePath: 'auth.error.permissionTokenInvalid',
170+
},
171+
{
172+
statusCode:
173+
ENUM_AUTH_STATUS_CODE_ERROR.AUTH_PERMISSION_TOKEN_NOT_YOUR_ERROR,
174+
messagePath: 'auth.error.permissionTokenNotYour',
175+
}
176+
);
177+
}
178+
157179
// request headers
158180
const requestHeaders = [];
159181
if (options?.requestHeader?.userAgent) {
@@ -291,7 +313,7 @@ export function DocPaging<T>(
291313
}
292314

293315
if (options?.auth?.apiKey) {
294-
auths.push(ApiBearerAuth('apiKey'));
316+
auths.push(ApiSecurity('apiKey'));
295317
oneOfUnauthorized.push(
296318
{
297319
statusCode: ENUM_API_KEY_STATUS_CODE_ERROR.API_KEY_NEEDED_ERROR,
@@ -315,6 +337,27 @@ export function DocPaging<T>(
315337
);
316338
}
317339

340+
if (options?.auth?.permissionToken) {
341+
auths.push(ApiSecurity('permissionToken'));
342+
oneOfUnauthorized.push(
343+
{
344+
statusCode:
345+
ENUM_AUTH_STATUS_CODE_ERROR.AUTH_PERMISSION_TOKEN_ERROR,
346+
messagePath: 'auth.error.permissionTokenUnauthorized',
347+
},
348+
{
349+
statusCode:
350+
ENUM_AUTH_STATUS_CODE_ERROR.AUTH_PERMISSION_TOKEN_INVALID_ERROR,
351+
messagePath: 'auth.error.permissionTokenInvalid',
352+
},
353+
{
354+
statusCode:
355+
ENUM_AUTH_STATUS_CODE_ERROR.AUTH_PERMISSION_TOKEN_NOT_YOUR_ERROR,
356+
messagePath: 'auth.error.permissionTokenNotYour',
357+
}
358+
);
359+
}
360+
318361
// request headers
319362
const requestHeaders = [];
320363
if (options?.requestHeader?.userAgent) {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export interface IDocAuthOptions {
5050
jwtAccessToken?: boolean;
5151
jwtRefreshToken?: boolean;
5252
apiKey?: boolean;
53+
permissionToken?: boolean;
5354
}
5455

5556
export interface IDocRequestHeaderOptions {

src/common/error/filters/error.http.filter.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ export class ErrorHttpFilter implements ExceptionFilter {
154154
.status(statusHttp)
155155
.json(resResponse);
156156
} else {
157-
console.error('exception', exception);
158157
// In certain situations `httpAdapter` might not be available in the
159158
// constructor method, thus we should resolve it here.
160159
const message: string = (await this.messageService.get(

src/common/logger/constants/logger.enum.constant.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ export enum ENUM_LOGGER_LEVEL {
99
}
1010

1111
export enum ENUM_LOGGER_ACTION {
12-
LOGIN = 'LOGIN',
1312
TEST = 'TEST',
1413
}
1514

src/common/setting/docs/setting.admin.doc.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export function SettingUpdateDoc(): MethodDecorator {
88
Doc<ResponseIdSerialization>('setting.update', {
99
auth: {
1010
jwtAccessToken: true,
11+
permissionToken: true,
1112
},
1213
request: {
1314
params: SettingDocParamsGet,

src/languages/en/permission.json

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/languages/en/role.json

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)