@hedhog/admin 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.js +12 -16
- package/package.json +3 -2
- package/dist/admin.module.d.ts +0 -3
- package/dist/admin.module.d.ts.map +0 -1
- package/dist/admin.module.js +0 -30
- package/dist/admin.module.js.map +0 -1
- package/dist/auth/src/auth.controller.d.ts +0 -21
- package/dist/auth/src/auth.controller.d.ts.map +0 -1
- package/dist/auth/src/auth.controller.js +0 -77
- package/dist/auth/src/auth.controller.js.map +0 -1
- package/dist/auth/src/auth.module.d.ts +0 -3
- package/dist/auth/src/auth.module.d.ts.map +0 -1
- package/dist/auth/src/auth.module.js +0 -50
- package/dist/auth/src/auth.module.js.map +0 -1
- package/dist/auth/src/auth.service.d.ts +0 -36
- package/dist/auth/src/auth.service.d.ts.map +0 -1
- package/dist/auth/src/auth.service.js +0 -162
- package/dist/auth/src/auth.service.js.map +0 -1
- package/dist/auth/src/auth.service.spec.d.ts +0 -2
- package/dist/auth/src/auth.service.spec.d.ts.map +0 -1
- package/dist/auth/src/auth.service.spec.js +0 -17
- package/dist/auth/src/auth.service.spec.js.map +0 -1
- package/dist/auth/src/decorators/public.decorator.d.ts +0 -3
- package/dist/auth/src/decorators/public.decorator.d.ts.map +0 -1
- package/dist/auth/src/decorators/public.decorator.js +0 -8
- package/dist/auth/src/decorators/public.decorator.js.map +0 -1
- package/dist/auth/src/decorators/user.decorator.d.ts +0 -2
- package/dist/auth/src/decorators/user.decorator.d.ts.map +0 -1
- package/dist/auth/src/decorators/user.decorator.js +0 -12
- package/dist/auth/src/decorators/user.decorator.js.map +0 -1
- package/dist/auth/src/dto/forget.dto.d.ts +0 -4
- package/dist/auth/src/dto/forget.dto.d.ts.map +0 -1
- package/dist/auth/src/dto/forget.dto.js +0 -21
- package/dist/auth/src/dto/forget.dto.js.map +0 -1
- package/dist/auth/src/dto/login.dto.d.ts +0 -5
- package/dist/auth/src/dto/login.dto.d.ts.map +0 -1
- package/dist/auth/src/dto/login.dto.js +0 -31
- package/dist/auth/src/dto/login.dto.js.map +0 -1
- package/dist/auth/src/dto/otp.dto.d.ts +0 -5
- package/dist/auth/src/dto/otp.dto.d.ts.map +0 -1
- package/dist/auth/src/dto/otp.dto.js +0 -27
- package/dist/auth/src/dto/otp.dto.js.map +0 -1
- package/dist/auth/src/enums/multifactor-type.enum.d.ts +0 -5
- package/dist/auth/src/enums/multifactor-type.enum.d.ts.map +0 -1
- package/dist/auth/src/enums/multifactor-type.enum.js +0 -9
- package/dist/auth/src/enums/multifactor-type.enum.js.map +0 -1
- package/dist/auth/src/guards/auth.guard.d.ts +0 -11
- package/dist/auth/src/guards/auth.guard.d.ts.map +0 -1
- package/dist/auth/src/guards/auth.guard.js +0 -56
- package/dist/auth/src/guards/auth.guard.js.map +0 -1
- package/dist/auth/src/migrations/index.d.ts +0 -6
- package/dist/auth/src/migrations/index.d.ts.map +0 -1
- package/dist/auth/src/migrations/index.js +0 -121
- package/dist/auth/src/migrations/index.js.map +0 -1
- package/dist/auth/src/types/user.type.d.ts +0 -9
- package/dist/auth/src/types/user.type.d.ts.map +0 -1
- package/dist/auth/src/types/user.type.js +0 -3
- package/dist/auth/src/types/user.type.js.map +0 -1
- package/dist/index.d.ts +0 -18
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/menu/src/dto/create.dto.d.ts +0 -8
- package/dist/menu/src/dto/create.dto.d.ts.map +0 -1
- package/dist/menu/src/dto/create.dto.js +0 -44
- package/dist/menu/src/dto/create.dto.js.map +0 -1
- package/dist/menu/src/dto/delete.dto.d.ts +0 -4
- package/dist/menu/src/dto/delete.dto.d.ts.map +0 -1
- package/dist/menu/src/dto/delete.dto.js +0 -24
- package/dist/menu/src/dto/delete.dto.js.map +0 -1
- package/dist/menu/src/dto/order.dto.d.ts +0 -4
- package/dist/menu/src/dto/order.dto.d.ts.map +0 -1
- package/dist/menu/src/dto/order.dto.js +0 -23
- package/dist/menu/src/dto/order.dto.js.map +0 -1
- package/dist/menu/src/dto/update.dto.d.ts +0 -7
- package/dist/menu/src/dto/update.dto.d.ts.map +0 -1
- package/dist/menu/src/dto/update.dto.js +0 -37
- package/dist/menu/src/dto/update.dto.js.map +0 -1
- package/dist/menu/src/menu.controller.d.ts +0 -19
- package/dist/menu/src/menu.controller.d.ts.map +0 -1
- package/dist/menu/src/menu.controller.js +0 -117
- package/dist/menu/src/menu.controller.js.map +0 -1
- package/dist/menu/src/menu.module.d.ts +0 -3
- package/dist/menu/src/menu.module.d.ts.map +0 -1
- package/dist/menu/src/menu.module.js +0 -31
- package/dist/menu/src/menu.module.js.map +0 -1
- package/dist/menu/src/menu.service.d.ts +0 -23
- package/dist/menu/src/menu.service.d.ts.map +0 -1
- package/dist/menu/src/menu.service.js +0 -117
- package/dist/menu/src/menu.service.js.map +0 -1
- package/dist/menu/src/migrations/index.d.ts +0 -7
- package/dist/menu/src/migrations/index.d.ts.map +0 -1
- package/dist/menu/src/migrations/index.js +0 -101
- package/dist/menu/src/migrations/index.js.map +0 -1
- package/dist/migrations/migrate-01.d.ts +0 -6
- package/dist/migrations/migrate-01.d.ts.map +0 -1
- package/dist/migrations/migrate-01.js +0 -121
- package/dist/migrations/migrate-01.js.map +0 -1
- package/dist/migrations/migrate-02.d.ts +0 -6
- package/dist/migrations/migrate-02.d.ts.map +0 -1
- package/dist/migrations/migrate-02.js +0 -40
- package/dist/migrations/migrate-02.js.map +0 -1
- package/dist/migrations/migrate-03.d.ts +0 -7
- package/dist/migrations/migrate-03.d.ts.map +0 -1
- package/dist/migrations/migrate-03.js +0 -101
- package/dist/migrations/migrate-03.js.map +0 -1
- package/dist/migrations/migrate-04.d.ts +0 -6
- package/dist/migrations/migrate-04.d.ts.map +0 -1
- package/dist/migrations/migrate-04.js +0 -525
- package/dist/migrations/migrate-04.js.map +0 -1
- package/dist/permission/src/decorators/permission.decorator.d.ts +0 -3
- package/dist/permission/src/decorators/permission.decorator.d.ts.map +0 -1
- package/dist/permission/src/decorators/permission.decorator.js +0 -8
- package/dist/permission/src/decorators/permission.decorator.js.map +0 -1
- package/dist/permission/src/dto/create.dto.d.ts +0 -5
- package/dist/permission/src/dto/create.dto.d.ts.map +0 -1
- package/dist/permission/src/dto/create.dto.js +0 -27
- package/dist/permission/src/dto/create.dto.js.map +0 -1
- package/dist/permission/src/dto/delete.dto.d.ts +0 -4
- package/dist/permission/src/dto/delete.dto.d.ts.map +0 -1
- package/dist/permission/src/dto/delete.dto.js +0 -23
- package/dist/permission/src/dto/delete.dto.js.map +0 -1
- package/dist/permission/src/dto/update.dto.d.ts +0 -5
- package/dist/permission/src/dto/update.dto.d.ts.map +0 -1
- package/dist/permission/src/dto/update.dto.js +0 -27
- package/dist/permission/src/dto/update.dto.js.map +0 -1
- package/dist/permission/src/guards/permission.guard.d.ts +0 -11
- package/dist/permission/src/guards/permission.guard.d.ts.map +0 -1
- package/dist/permission/src/guards/permission.guard.js +0 -99
- package/dist/permission/src/guards/permission.guard.js.map +0 -1
- package/dist/permission/src/migrations/index.d.ts +0 -6
- package/dist/permission/src/migrations/index.d.ts.map +0 -1
- package/dist/permission/src/migrations/index.js +0 -520
- package/dist/permission/src/migrations/index.js.map +0 -1
- package/dist/permission/src/permission.controller.d.ts +0 -14
- package/dist/permission/src/permission.controller.d.ts.map +0 -1
- package/dist/permission/src/permission.controller.js +0 -95
- package/dist/permission/src/permission.controller.js.map +0 -1
- package/dist/permission/src/permission.module.d.ts +0 -3
- package/dist/permission/src/permission.module.d.ts.map +0 -1
- package/dist/permission/src/permission.module.js +0 -39
- package/dist/permission/src/permission.module.js.map +0 -1
- package/dist/permission/src/permission.service.d.ts +0 -19
- package/dist/permission/src/permission.service.d.ts.map +0 -1
- package/dist/permission/src/permission.service.js +0 -73
- package/dist/permission/src/permission.service.js.map +0 -1
- package/dist/permission/src/types/permission.types.d.ts +0 -33
- package/dist/permission/src/types/permission.types.d.ts.map +0 -1
- package/dist/permission/src/types/permission.types.js +0 -3
- package/dist/permission/src/types/permission.types.js.map +0 -1
- package/dist/screen/src/dto/create.dto.d.ts +0 -7
- package/dist/screen/src/dto/create.dto.d.ts.map +0 -1
- package/dist/screen/src/dto/create.dto.js +0 -37
- package/dist/screen/src/dto/create.dto.js.map +0 -1
- package/dist/screen/src/dto/delete.dto.d.ts +0 -4
- package/dist/screen/src/dto/delete.dto.d.ts.map +0 -1
- package/dist/screen/src/dto/delete.dto.js +0 -23
- package/dist/screen/src/dto/delete.dto.js.map +0 -1
- package/dist/screen/src/dto/update.dto.d.ts +0 -7
- package/dist/screen/src/dto/update.dto.d.ts.map +0 -1
- package/dist/screen/src/dto/update.dto.js +0 -37
- package/dist/screen/src/dto/update.dto.js.map +0 -1
- package/dist/screen/src/migrations/index.d.ts +0 -6
- package/dist/screen/src/migrations/index.d.ts.map +0 -1
- package/dist/screen/src/migrations/index.js +0 -40
- package/dist/screen/src/migrations/index.js.map +0 -1
- package/dist/screen/src/screen.controller.d.ts +0 -14
- package/dist/screen/src/screen.controller.d.ts.map +0 -1
- package/dist/screen/src/screen.controller.js +0 -94
- package/dist/screen/src/screen.controller.js.map +0 -1
- package/dist/screen/src/screen.module.d.ts +0 -3
- package/dist/screen/src/screen.module.d.ts.map +0 -1
- package/dist/screen/src/screen.module.js +0 -31
- package/dist/screen/src/screen.module.js.map +0 -1
- package/dist/screen/src/screen.service.d.ts +0 -19
- package/dist/screen/src/screen.service.d.ts.map +0 -1
- package/dist/screen/src/screen.service.js +0 -73
- package/dist/screen/src/screen.service.js.map +0 -1
- package/dist/user/src/constants/user.constants.d.ts +0 -2
- package/dist/user/src/constants/user.constants.d.ts.map +0 -1
- package/dist/user/src/constants/user.constants.js +0 -5
- package/dist/user/src/constants/user.constants.js.map +0 -1
- package/dist/user/src/dto/create.dto.d.ts +0 -6
- package/dist/user/src/dto/create.dto.d.ts.map +0 -1
- package/dist/user/src/dto/create.dto.js +0 -37
- package/dist/user/src/dto/create.dto.js.map +0 -1
- package/dist/user/src/dto/delete.dto.d.ts +0 -4
- package/dist/user/src/dto/delete.dto.d.ts.map +0 -1
- package/dist/user/src/dto/delete.dto.js +0 -23
- package/dist/user/src/dto/delete.dto.js.map +0 -1
- package/dist/user/src/dto/update.dto.d.ts +0 -8
- package/dist/user/src/dto/update.dto.d.ts.map +0 -1
- package/dist/user/src/dto/update.dto.js +0 -50
- package/dist/user/src/dto/update.dto.js.map +0 -1
- package/dist/user/src/user.controller.d.ts +0 -14
- package/dist/user/src/user.controller.d.ts.map +0 -1
- package/dist/user/src/user.controller.js +0 -94
- package/dist/user/src/user.controller.js.map +0 -1
- package/dist/user/src/user.module.d.ts +0 -3
- package/dist/user/src/user.module.d.ts.map +0 -1
- package/dist/user/src/user.module.js +0 -31
- package/dist/user/src/user.module.js.map +0 -1
- package/dist/user/src/user.service.d.ts +0 -20
- package/dist/user/src/user.service.d.ts.map +0 -1
- package/dist/user/src/user.service.js +0 -84
- package/dist/user/src/user.service.js.map +0 -1
- package/dist/user/src/user.service.spec.d.ts +0 -2
- package/dist/user/src/user.service.spec.d.ts.map +0 -1
- package/dist/user/src/user.service.spec.js +0 -17
- package/dist/user/src/user.service.spec.js.map +0 -1
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"permission.decorator.js","sourceRoot":"","sources":["../../../../src/permission/src/decorators/permission.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAA6C;AAEhC,QAAA,eAAe,GAAG,gBAAgB,CAAC;AACzC,MAAM,UAAU,GAAG,GAAG,EAAE,CAAC,IAAA,oBAAW,EAAC,uBAAe,EAAE,IAAI,CAAC,CAAC;AAAtD,QAAA,UAAU,cAA4C"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"create.dto.d.ts","sourceRoot":"","sources":["../../../../src/permission/src/dto/create.dto.ts"],"names":[],"mappings":"AAEA,qBAAa,SAAS;IAGpB,IAAI,EAAE,MAAM,CAAC;IAIb,WAAW,EAAE,MAAM,CAAC;CACrB"}
|
@@ -1,27 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
-
};
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
|
-
};
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
-
exports.CreateDTO = void 0;
|
13
|
-
const class_validator_1 = require("class-validator");
|
14
|
-
class CreateDTO {
|
15
|
-
}
|
16
|
-
exports.CreateDTO = CreateDTO;
|
17
|
-
__decorate([
|
18
|
-
(0, class_validator_1.IsString)({ message: 'O nome deve ser uma string' }),
|
19
|
-
(0, class_validator_1.IsNotEmpty)({ message: 'O nome é obrigatório.' }),
|
20
|
-
__metadata("design:type", String)
|
21
|
-
], CreateDTO.prototype, "name", void 0);
|
22
|
-
__decorate([
|
23
|
-
(0, class_validator_1.IsString)({ message: 'A descrição deve ser uma string' }),
|
24
|
-
(0, class_validator_1.IsNotEmpty)({ message: 'A descrição é obrigatória.' }),
|
25
|
-
__metadata("design:type", String)
|
26
|
-
], CreateDTO.prototype, "description", void 0);
|
27
|
-
//# sourceMappingURL=create.dto.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"create.dto.js","sourceRoot":"","sources":["../../../../src/permission/src/dto/create.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAuD;AAEvD,MAAa,SAAS;CAQrB;AARD,8BAQC;AALC;IAFC,IAAA,0BAAQ,EAAC,EAAE,OAAO,EAAE,4BAA4B,EAAE,CAAC;IACnD,IAAA,4BAAU,EAAC,EAAE,OAAO,EAAE,uBAAuB,EAAE,CAAC;;uCACpC;AAIb;IAFC,IAAA,0BAAQ,EAAC,EAAE,OAAO,EAAE,iCAAiC,EAAE,CAAC;IACxD,IAAA,4BAAU,EAAC,EAAE,OAAO,EAAE,4BAA4B,EAAE,CAAC;;8CAClC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"delete.dto.d.ts","sourceRoot":"","sources":["../../../../src/permission/src/dto/delete.dto.ts"],"names":[],"mappings":"AAEA,qBAAa,SAAS;IAIpB,GAAG,EAAE,MAAM,EAAE,CAAC;CACf"}
|
@@ -1,23 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
-
};
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
|
-
};
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
-
exports.DeleteDTO = void 0;
|
13
|
-
const class_validator_1 = require("class-validator");
|
14
|
-
class DeleteDTO {
|
15
|
-
}
|
16
|
-
exports.DeleteDTO = DeleteDTO;
|
17
|
-
__decorate([
|
18
|
-
(0, class_validator_1.IsArray)(),
|
19
|
-
(0, class_validator_1.ArrayMinSize)(1),
|
20
|
-
(0, class_validator_1.IsInt)({ each: true }),
|
21
|
-
__metadata("design:type", Array)
|
22
|
-
], DeleteDTO.prototype, "ids", void 0);
|
23
|
-
//# sourceMappingURL=delete.dto.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"delete.dto.js","sourceRoot":"","sources":["../../../../src/permission/src/dto/delete.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA+D;AAE/D,MAAa,SAAS;CAKrB;AALD,8BAKC;AADC;IAHC,IAAA,yBAAO,GAAE;IACT,IAAA,8BAAY,EAAC,CAAC,CAAC;IACf,IAAA,uBAAK,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;;sCACR"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"update.dto.d.ts","sourceRoot":"","sources":["../../../../src/permission/src/dto/update.dto.ts"],"names":[],"mappings":"AAEA,qBAAa,SAAS;IAGpB,IAAI,CAAC,EAAE,MAAM,CAAC;IAId,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
|
@@ -1,27 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
-
};
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
|
-
};
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
-
exports.UpdateDTO = void 0;
|
13
|
-
const class_validator_1 = require("class-validator");
|
14
|
-
class UpdateDTO {
|
15
|
-
}
|
16
|
-
exports.UpdateDTO = UpdateDTO;
|
17
|
-
__decorate([
|
18
|
-
(0, class_validator_1.IsOptional)(),
|
19
|
-
(0, class_validator_1.IsString)({ message: 'O nome deve ser uma string' }),
|
20
|
-
__metadata("design:type", String)
|
21
|
-
], UpdateDTO.prototype, "name", void 0);
|
22
|
-
__decorate([
|
23
|
-
(0, class_validator_1.IsOptional)(),
|
24
|
-
(0, class_validator_1.IsString)({ message: 'A descrição deve ser uma string' }),
|
25
|
-
__metadata("design:type", String)
|
26
|
-
], UpdateDTO.prototype, "description", void 0);
|
27
|
-
//# sourceMappingURL=update.dto.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"update.dto.js","sourceRoot":"","sources":["../../../../src/permission/src/dto/update.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAuD;AAEvD,MAAa,SAAS;CAQrB;AARD,8BAQC;AALC;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,EAAC,EAAE,OAAO,EAAE,4BAA4B,EAAE,CAAC;;uCACtC;AAId;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,EAAC,EAAE,OAAO,EAAE,iCAAiC,EAAE,CAAC;;8CACpC"}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import { CanActivate, ExecutionContext } from '@nestjs/common';
|
2
|
-
import { Reflector } from '@nestjs/core';
|
3
|
-
import { PrismaService } from '@hedhog/prisma';
|
4
|
-
export declare class PermissionGuard implements CanActivate {
|
5
|
-
private reflector;
|
6
|
-
private prisma;
|
7
|
-
constructor(reflector: Reflector, prisma: PrismaService);
|
8
|
-
canActivate(context: ExecutionContext): Promise<boolean>;
|
9
|
-
private extractTokenFromHeader;
|
10
|
-
}
|
11
|
-
//# sourceMappingURL=permission.guard.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"permission.guard.d.ts","sourceRoot":"","sources":["../../../../src/permission/src/guards/permission.guard.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,gBAAgB,EAIjB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,qBACa,eAAgB,YAAW,WAAW;IAE/C,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,MAAM;gBADN,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,aAAa;IAGzB,WAAW,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC;IAgF9D,OAAO,CAAC,sBAAsB;CAI/B"}
|
@@ -1,99 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
-
};
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
|
-
};
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
-
exports.PermissionGuard = void 0;
|
13
|
-
const common_1 = require("@nestjs/common");
|
14
|
-
const core_1 = require("@nestjs/core");
|
15
|
-
const constants_1 = require("@nestjs/common/constants");
|
16
|
-
const permission_decorator_1 = require("../decorators/permission.decorator");
|
17
|
-
const prisma_1 = require("@hedhog/prisma");
|
18
|
-
let PermissionGuard = class PermissionGuard {
|
19
|
-
constructor(reflector, prisma) {
|
20
|
-
this.reflector = reflector;
|
21
|
-
this.prisma = prisma;
|
22
|
-
}
|
23
|
-
async canActivate(context) {
|
24
|
-
var _a, _b;
|
25
|
-
const withPermission = this.reflector.getAllAndOverride(permission_decorator_1.WITH_PERMISSION, [context.getHandler(), context.getClass()]);
|
26
|
-
if (!withPermission) {
|
27
|
-
return true;
|
28
|
-
}
|
29
|
-
const request = context.switchToHttp().getRequest();
|
30
|
-
const controller = context.getClass();
|
31
|
-
const handler = context.getHandler();
|
32
|
-
const controllerPath = this.reflector.get('path', controller) || '';
|
33
|
-
const methodPath = this.reflector.get('path', handler) || '';
|
34
|
-
const requestMethod = this.reflector.get(constants_1.METHOD_METADATA, handler);
|
35
|
-
const fullPath = `/${controllerPath}/${methodPath}`.replace(/\/+/g, '/');
|
36
|
-
const token = this.extractTokenFromHeader(request);
|
37
|
-
if (!token) {
|
38
|
-
throw new common_1.UnauthorizedException();
|
39
|
-
}
|
40
|
-
const userId = (_b = (_a = request === null || request === void 0 ? void 0 : request.auth) === null || _a === void 0 ? void 0 : _a.user) === null || _b === void 0 ? void 0 : _b.id;
|
41
|
-
let httpMethod;
|
42
|
-
switch (requestMethod) {
|
43
|
-
case common_1.RequestMethod.GET:
|
44
|
-
httpMethod = 'GET';
|
45
|
-
break;
|
46
|
-
case common_1.RequestMethod.POST:
|
47
|
-
httpMethod = 'POST';
|
48
|
-
break;
|
49
|
-
case common_1.RequestMethod.PUT:
|
50
|
-
httpMethod = 'PUT';
|
51
|
-
break;
|
52
|
-
case common_1.RequestMethod.DELETE:
|
53
|
-
httpMethod = 'DELETE';
|
54
|
-
break;
|
55
|
-
case common_1.RequestMethod.PATCH:
|
56
|
-
httpMethod = 'PATCH';
|
57
|
-
break;
|
58
|
-
case common_1.RequestMethod.OPTIONS:
|
59
|
-
httpMethod = 'OPTIONS';
|
60
|
-
break;
|
61
|
-
case common_1.RequestMethod.HEAD:
|
62
|
-
httpMethod = 'HEAD';
|
63
|
-
break;
|
64
|
-
case common_1.RequestMethod.ALL:
|
65
|
-
httpMethod = 'ALL';
|
66
|
-
break;
|
67
|
-
}
|
68
|
-
const route = await this.prisma.routes.count({
|
69
|
-
where: {
|
70
|
-
method: httpMethod,
|
71
|
-
url: fullPath,
|
72
|
-
role_routes: {
|
73
|
-
some: {
|
74
|
-
roles: {
|
75
|
-
role_users: {
|
76
|
-
some: {
|
77
|
-
user_id: Number(userId),
|
78
|
-
},
|
79
|
-
},
|
80
|
-
},
|
81
|
-
},
|
82
|
-
},
|
83
|
-
},
|
84
|
-
});
|
85
|
-
return route === 1;
|
86
|
-
}
|
87
|
-
extractTokenFromHeader(request) {
|
88
|
-
var _a, _b;
|
89
|
-
const [type, token] = (_b = (_a = request.headers.authorization) === null || _a === void 0 ? void 0 : _a.split(' ')) !== null && _b !== void 0 ? _b : [];
|
90
|
-
return type === 'Bearer' ? token : undefined;
|
91
|
-
}
|
92
|
-
};
|
93
|
-
exports.PermissionGuard = PermissionGuard;
|
94
|
-
exports.PermissionGuard = PermissionGuard = __decorate([
|
95
|
-
(0, common_1.Injectable)(),
|
96
|
-
__metadata("design:paramtypes", [core_1.Reflector,
|
97
|
-
prisma_1.PrismaService])
|
98
|
-
], PermissionGuard);
|
99
|
-
//# sourceMappingURL=permission.guard.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"permission.guard.js","sourceRoot":"","sources":["../../../../src/permission/src/guards/permission.guard.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAMwB;AAExB,uCAAyC;AACzC,wDAA2D;AAC3D,6EAAqE;AACrE,2CAA+C;AAGxC,IAAM,eAAe,GAArB,MAAM,eAAe;IAC1B,YACU,SAAoB,EACpB,MAAqB;QADrB,cAAS,GAAT,SAAS,CAAW;QACpB,WAAM,GAAN,MAAM,CAAe;IAC5B,CAAC;IAEJ,KAAK,CAAC,WAAW,CAAC,OAAyB;;QACzC,MAAM,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC,iBAAiB,CACrD,sCAA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