@hedhog/admin 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/admin.module.d.ts +3 -0
- package/dist/admin.module.d.ts.map +1 -0
- package/dist/admin.module.js +33 -0
- package/dist/admin.module.js.map +1 -0
- package/dist/auth/src/auth.controller.d.ts +21 -0
- package/dist/auth/src/auth.controller.d.ts.map +1 -0
- package/dist/auth/src/auth.controller.js +77 -0
- package/dist/auth/src/auth.controller.js.map +1 -0
- package/dist/auth/src/auth.module.d.ts +3 -0
- package/dist/auth/src/auth.module.d.ts.map +1 -0
- package/dist/auth/src/auth.module.js +50 -0
- package/dist/auth/src/auth.module.js.map +1 -0
- package/dist/auth/src/auth.service.d.ts +36 -0
- package/dist/auth/src/auth.service.d.ts.map +1 -0
- package/dist/auth/src/auth.service.js +162 -0
- package/dist/auth/src/auth.service.js.map +1 -0
- package/dist/auth/src/auth.service.spec.d.ts +2 -0
- package/dist/auth/src/auth.service.spec.d.ts.map +1 -0
- package/dist/auth/src/auth.service.spec.js +17 -0
- package/dist/auth/src/auth.service.spec.js.map +1 -0
- package/dist/auth/src/decorators/public.decorator.d.ts +3 -0
- package/dist/auth/src/decorators/public.decorator.d.ts.map +1 -0
- package/dist/auth/src/decorators/public.decorator.js +8 -0
- package/dist/auth/src/decorators/public.decorator.js.map +1 -0
- package/dist/auth/src/decorators/user.decorator.d.ts +2 -0
- package/dist/auth/src/decorators/user.decorator.d.ts.map +1 -0
- package/dist/auth/src/decorators/user.decorator.js +12 -0
- package/dist/auth/src/decorators/user.decorator.js.map +1 -0
- package/dist/auth/src/dto/forget.dto.d.ts +4 -0
- package/dist/auth/src/dto/forget.dto.d.ts.map +1 -0
- package/dist/auth/src/dto/forget.dto.js +21 -0
- package/dist/auth/src/dto/forget.dto.js.map +1 -0
- package/dist/auth/src/dto/login.dto.d.ts +5 -0
- package/dist/auth/src/dto/login.dto.d.ts.map +1 -0
- package/dist/auth/src/dto/login.dto.js +31 -0
- package/dist/auth/src/dto/login.dto.js.map +1 -0
- package/dist/auth/src/dto/otp.dto.d.ts +5 -0
- package/dist/auth/src/dto/otp.dto.d.ts.map +1 -0
- package/dist/auth/src/dto/otp.dto.js +27 -0
- package/dist/auth/src/dto/otp.dto.js.map +1 -0
- package/dist/auth/src/enums/multifactor-type.enum.d.ts +5 -0
- package/dist/auth/src/enums/multifactor-type.enum.d.ts.map +1 -0
- package/dist/auth/src/enums/multifactor-type.enum.js +9 -0
- package/dist/auth/src/enums/multifactor-type.enum.js.map +1 -0
- package/dist/auth/src/guards/auth.guard.d.ts +11 -0
- package/dist/auth/src/guards/auth.guard.d.ts.map +1 -0
- package/dist/auth/src/guards/auth.guard.js +56 -0
- package/dist/auth/src/guards/auth.guard.js.map +1 -0
- package/dist/auth/src/migrations/index.d.ts +6 -0
- package/dist/auth/src/migrations/index.d.ts.map +1 -0
- package/dist/auth/src/migrations/index.js +121 -0
- package/dist/auth/src/migrations/index.js.map +1 -0
- package/dist/auth/src/types/user.type.d.ts +9 -0
- package/dist/auth/src/types/user.type.d.ts.map +1 -0
- package/dist/auth/src/types/user.type.js +3 -0
- package/dist/auth/src/types/user.type.js.map +1 -0
- package/dist/file/src/dto/delete.dto.d.ts +4 -0
- package/dist/file/src/dto/delete.dto.d.ts.map +1 -0
- package/dist/file/src/dto/delete.dto.js +23 -0
- package/dist/file/src/dto/delete.dto.js.map +1 -0
- package/dist/file/src/file.module.d.ts +3 -0
- package/dist/file/src/file.module.d.ts.map +1 -0
- package/dist/file/src/file.module.js +29 -0
- package/dist/file/src/file.module.js.map +1 -0
- package/dist/file/src/file.service.d.ts +12 -0
- package/dist/file/src/file.service.d.ts.map +1 -0
- package/dist/file/src/file.service.js +59 -0
- package/dist/file/src/file.service.js.map +1 -0
- package/dist/file/src/migrations/index.d.ts +6 -0
- package/dist/file/src/migrations/index.d.ts.map +1 -0
- package/dist/file/src/migrations/index.js +137 -0
- package/dist/file/src/migrations/index.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +51 -0
- package/dist/index.js.map +1 -0
- package/dist/mail/src/enums/mail-configuration-type.enum.d.ts +6 -0
- package/dist/mail/src/enums/mail-configuration-type.enum.d.ts.map +1 -0
- package/dist/mail/src/enums/mail-configuration-type.enum.js +10 -0
- package/dist/mail/src/enums/mail-configuration-type.enum.js.map +1 -0
- package/dist/mail/src/interfaces/index.d.ts +3 -0
- package/dist/mail/src/interfaces/index.d.ts.map +1 -0
- package/dist/mail/src/interfaces/index.js +19 -0
- package/dist/mail/src/interfaces/index.js.map +1 -0
- package/dist/mail/src/interfaces/mail-module-options.interface.d.ts +32 -0
- package/dist/mail/src/interfaces/mail-module-options.interface.d.ts.map +1 -0
- package/dist/mail/src/interfaces/mail-module-options.interface.js +3 -0
- package/dist/mail/src/interfaces/mail-module-options.interface.js.map +1 -0
- package/dist/mail/src/interfaces/mail-type.d.ts +13 -0
- package/dist/mail/src/interfaces/mail-type.d.ts.map +1 -0
- package/dist/mail/src/interfaces/mail-type.js +3 -0
- package/dist/mail/src/interfaces/mail-type.js.map +1 -0
- package/dist/mail/src/mail.consts.d.ts +17 -0
- package/dist/mail/src/mail.consts.d.ts.map +1 -0
- package/dist/mail/src/mail.consts.js +5 -0
- package/dist/mail/src/mail.consts.js.map +1 -0
- package/dist/mail/src/mail.module.d.ts +8 -0
- package/dist/mail/src/mail.module.d.ts.map +1 -0
- package/dist/mail/src/mail.module.js +51 -0
- package/dist/mail/src/mail.module.js.map +1 -0
- package/dist/mail/src/mail.service.d.ts +14 -0
- package/dist/mail/src/mail.service.d.ts.map +1 -0
- package/dist/mail/src/mail.service.js +281 -0
- package/dist/mail/src/mail.service.js.map +1 -0
- package/dist/mail/src/mail.service.spec.d.ts +2 -0
- package/dist/mail/src/mail.service.spec.d.ts.map +1 -0
- package/dist/mail/src/mail.service.spec.js +17 -0
- package/dist/mail/src/mail.service.spec.js.map +1 -0
- package/dist/menu/src/dto/create.dto.d.ts +8 -0
- package/dist/menu/src/dto/create.dto.d.ts.map +1 -0
- package/dist/menu/src/dto/create.dto.js +44 -0
- package/dist/menu/src/dto/create.dto.js.map +1 -0
- package/dist/menu/src/dto/delete.dto.d.ts +4 -0
- package/dist/menu/src/dto/delete.dto.d.ts.map +1 -0
- package/dist/menu/src/dto/delete.dto.js +24 -0
- package/dist/menu/src/dto/delete.dto.js.map +1 -0
- package/dist/menu/src/dto/order.dto.d.ts +4 -0
- package/dist/menu/src/dto/order.dto.d.ts.map +1 -0
- package/dist/menu/src/dto/order.dto.js +23 -0
- package/dist/menu/src/dto/order.dto.js.map +1 -0
- package/dist/menu/src/dto/update.dto.d.ts +7 -0
- package/dist/menu/src/dto/update.dto.d.ts.map +1 -0
- package/dist/menu/src/dto/update.dto.js +37 -0
- package/dist/menu/src/dto/update.dto.js.map +1 -0
- package/dist/menu/src/menu.controller.d.ts +19 -0
- package/dist/menu/src/menu.controller.d.ts.map +1 -0
- package/dist/menu/src/menu.controller.js +117 -0
- package/dist/menu/src/menu.controller.js.map +1 -0
- package/dist/menu/src/menu.module.d.ts +3 -0
- package/dist/menu/src/menu.module.d.ts.map +1 -0
- package/dist/menu/src/menu.module.js +31 -0
- package/dist/menu/src/menu.module.js.map +1 -0
- package/dist/menu/src/menu.service.d.ts +23 -0
- package/dist/menu/src/menu.service.d.ts.map +1 -0
- package/dist/menu/src/menu.service.js +117 -0
- package/dist/menu/src/menu.service.js.map +1 -0
- package/dist/menu/src/migrations/index.d.ts +7 -0
- package/dist/menu/src/migrations/index.d.ts.map +1 -0
- package/dist/menu/src/migrations/index.js +101 -0
- package/dist/menu/src/migrations/index.js.map +1 -0
- package/dist/migrations/1726795702341-migrate.d.ts +6 -0
- package/dist/migrations/1726795702341-migrate.d.ts.map +1 -0
- package/dist/migrations/1726795702341-migrate.js +121 -0
- package/dist/migrations/1726795702341-migrate.js.map +1 -0
- package/dist/migrations/1726795734665-migrate.d.ts +6 -0
- package/dist/migrations/1726795734665-migrate.d.ts.map +1 -0
- package/dist/migrations/1726795734665-migrate.js +40 -0
- package/dist/migrations/1726795734665-migrate.js.map +1 -0
- package/dist/migrations/1726795818403-migrate.d.ts +7 -0
- package/dist/migrations/1726795818403-migrate.d.ts.map +1 -0
- package/dist/migrations/1726795818403-migrate.js +101 -0
- package/dist/migrations/1726795818403-migrate.js.map +1 -0
- package/dist/migrations/1726795828359-migrate.d.ts +6 -0
- package/dist/migrations/1726795828359-migrate.d.ts.map +1 -0
- package/dist/migrations/1726795828359-migrate.js +525 -0
- package/dist/migrations/1726795828359-migrate.js.map +1 -0
- package/dist/permission/src/decorators/permission.decorator.d.ts +3 -0
- package/dist/permission/src/decorators/permission.decorator.d.ts.map +1 -0
- package/dist/permission/src/decorators/permission.decorator.js +8 -0
- package/dist/permission/src/decorators/permission.decorator.js.map +1 -0
- package/dist/permission/src/dto/create.dto.d.ts +5 -0
- package/dist/permission/src/dto/create.dto.d.ts.map +1 -0
- package/dist/permission/src/dto/create.dto.js +27 -0
- package/dist/permission/src/dto/create.dto.js.map +1 -0
- package/dist/permission/src/dto/delete.dto.d.ts +4 -0
- package/dist/permission/src/dto/delete.dto.d.ts.map +1 -0
- package/dist/permission/src/dto/delete.dto.js +23 -0
- package/dist/permission/src/dto/delete.dto.js.map +1 -0
- package/dist/permission/src/dto/update.dto.d.ts +5 -0
- package/dist/permission/src/dto/update.dto.d.ts.map +1 -0
- package/dist/permission/src/dto/update.dto.js +27 -0
- package/dist/permission/src/dto/update.dto.js.map +1 -0
- package/dist/permission/src/guards/permission.guard.d.ts +11 -0
- package/dist/permission/src/guards/permission.guard.d.ts.map +1 -0
- package/dist/permission/src/guards/permission.guard.js +99 -0
- package/dist/permission/src/guards/permission.guard.js.map +1 -0
- package/dist/permission/src/migrations/index.d.ts +6 -0
- package/dist/permission/src/migrations/index.d.ts.map +1 -0
- package/dist/permission/src/migrations/index.js +520 -0
- package/dist/permission/src/migrations/index.js.map +1 -0
- package/dist/permission/src/permission.controller.d.ts +14 -0
- package/dist/permission/src/permission.controller.d.ts.map +1 -0
- package/dist/permission/src/permission.controller.js +95 -0
- package/dist/permission/src/permission.controller.js.map +1 -0
- package/dist/permission/src/permission.module.d.ts +3 -0
- package/dist/permission/src/permission.module.d.ts.map +1 -0
- package/dist/permission/src/permission.module.js +39 -0
- package/dist/permission/src/permission.module.js.map +1 -0
- package/dist/permission/src/permission.service.d.ts +19 -0
- package/dist/permission/src/permission.service.d.ts.map +1 -0
- package/dist/permission/src/permission.service.js +73 -0
- package/dist/permission/src/permission.service.js.map +1 -0
- package/dist/permission/src/types/permission.types.d.ts +33 -0
- package/dist/permission/src/types/permission.types.d.ts.map +1 -0
- package/dist/permission/src/types/permission.types.js +3 -0
- package/dist/permission/src/types/permission.types.js.map +1 -0
- package/dist/screen/src/dto/create.dto.d.ts +7 -0
- package/dist/screen/src/dto/create.dto.d.ts.map +1 -0
- package/dist/screen/src/dto/create.dto.js +37 -0
- package/dist/screen/src/dto/create.dto.js.map +1 -0
- package/dist/screen/src/dto/delete.dto.d.ts +4 -0
- package/dist/screen/src/dto/delete.dto.d.ts.map +1 -0
- package/dist/screen/src/dto/delete.dto.js +23 -0
- package/dist/screen/src/dto/delete.dto.js.map +1 -0
- package/dist/screen/src/dto/update.dto.d.ts +7 -0
- package/dist/screen/src/dto/update.dto.d.ts.map +1 -0
- package/dist/screen/src/dto/update.dto.js +37 -0
- package/dist/screen/src/dto/update.dto.js.map +1 -0
- package/dist/screen/src/migrations/index.d.ts +6 -0
- package/dist/screen/src/migrations/index.d.ts.map +1 -0
- package/dist/screen/src/migrations/index.js +40 -0
- package/dist/screen/src/migrations/index.js.map +1 -0
- package/dist/screen/src/screen.controller.d.ts +14 -0
- package/dist/screen/src/screen.controller.d.ts.map +1 -0
- package/dist/screen/src/screen.controller.js +94 -0
- package/dist/screen/src/screen.controller.js.map +1 -0
- package/dist/screen/src/screen.module.d.ts +3 -0
- package/dist/screen/src/screen.module.d.ts.map +1 -0
- package/dist/screen/src/screen.module.js +31 -0
- package/dist/screen/src/screen.module.js.map +1 -0
- package/dist/screen/src/screen.service.d.ts +19 -0
- package/dist/screen/src/screen.service.d.ts.map +1 -0
- package/dist/screen/src/screen.service.js +73 -0
- package/dist/screen/src/screen.service.js.map +1 -0
- package/dist/setting/src/dto/create.dto.d.ts +4 -0
- package/dist/setting/src/dto/create.dto.d.ts.map +1 -0
- package/dist/setting/src/dto/create.dto.js +22 -0
- package/dist/setting/src/dto/create.dto.js.map +1 -0
- package/dist/setting/src/dto/delete.dto.d.ts +4 -0
- package/dist/setting/src/dto/delete.dto.d.ts.map +1 -0
- package/dist/setting/src/dto/delete.dto.js +23 -0
- package/dist/setting/src/dto/delete.dto.js.map +1 -0
- package/dist/setting/src/dto/update.dto.d.ts +4 -0
- package/dist/setting/src/dto/update.dto.d.ts.map +1 -0
- package/dist/setting/src/dto/update.dto.js +8 -0
- package/dist/setting/src/dto/update.dto.js.map +1 -0
- package/dist/setting/src/migrations/index.d.ts +6 -0
- package/dist/setting/src/migrations/index.d.ts.map +1 -0
- package/dist/setting/src/migrations/index.js +67 -0
- package/dist/setting/src/migrations/index.js.map +1 -0
- package/dist/setting/src/settings.controller.d.ts +14 -0
- package/dist/setting/src/settings.controller.d.ts.map +1 -0
- package/dist/setting/src/settings.controller.js +94 -0
- package/dist/setting/src/settings.controller.js.map +1 -0
- package/dist/setting/src/settings.module.d.ts +3 -0
- package/dist/setting/src/settings.module.d.ts.map +1 -0
- package/dist/setting/src/settings.module.js +31 -0
- package/dist/setting/src/settings.module.js.map +1 -0
- package/dist/setting/src/settings.service.d.ts +19 -0
- package/dist/setting/src/settings.service.d.ts.map +1 -0
- package/dist/setting/src/settings.service.js +70 -0
- package/dist/setting/src/settings.service.js.map +1 -0
- package/dist/user/src/constants/user.constants.d.ts +2 -0
- package/dist/user/src/constants/user.constants.d.ts.map +1 -0
- package/dist/user/src/constants/user.constants.js +5 -0
- package/dist/user/src/constants/user.constants.js.map +1 -0
- package/dist/user/src/dto/create.dto.d.ts +6 -0
- package/dist/user/src/dto/create.dto.d.ts.map +1 -0
- package/dist/user/src/dto/create.dto.js +37 -0
- package/dist/user/src/dto/create.dto.js.map +1 -0
- package/dist/user/src/dto/delete.dto.d.ts +4 -0
- package/dist/user/src/dto/delete.dto.d.ts.map +1 -0
- package/dist/user/src/dto/delete.dto.js +23 -0
- package/dist/user/src/dto/delete.dto.js.map +1 -0
- package/dist/user/src/dto/update.dto.d.ts +8 -0
- package/dist/user/src/dto/update.dto.d.ts.map +1 -0
- package/dist/user/src/dto/update.dto.js +50 -0
- package/dist/user/src/dto/update.dto.js.map +1 -0
- package/dist/user/src/user.controller.d.ts +14 -0
- package/dist/user/src/user.controller.d.ts.map +1 -0
- package/dist/user/src/user.controller.js +94 -0
- package/dist/user/src/user.controller.js.map +1 -0
- package/dist/user/src/user.module.d.ts +3 -0
- package/dist/user/src/user.module.d.ts.map +1 -0
- package/dist/user/src/user.module.js +31 -0
- package/dist/user/src/user.module.js.map +1 -0
- package/dist/user/src/user.service.d.ts +20 -0
- package/dist/user/src/user.service.d.ts.map +1 -0
- package/dist/user/src/user.service.js +84 -0
- package/dist/user/src/user.service.js.map +1 -0
- package/dist/user/src/user.service.spec.d.ts +2 -0
- package/dist/user/src/user.service.spec.d.ts.map +1 -0
- package/dist/user/src/user.service.spec.js +17 -0
- package/dist/user/src/user.service.spec.js.map +1 -0
- package/package.json +29 -0
- package/src/mail/src/mail.template.ejs +1 -0
- package/src/migrations/1726795702341-migrate.ts +107 -0
- package/src/migrations/1726795734665-migrate.ts +40 -0
- package/src/migrations/1726795818403-migrate.ts +161 -0
- package/src/migrations/1726795828359-migrate.ts +573 -0
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"multifactor-type.enum.d.ts","sourceRoot":"","sources":["../../../../src/auth/src/enums/multifactor-type.enum.ts"],"names":[],"mappings":"AAAA,oBAAY,eAAe;IACzB,KAAK,IAAI;IACT,GAAG,IAAI;CACR"}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.MultifactorType = void 0;
|
4
|
+
var MultifactorType;
|
5
|
+
(function (MultifactorType) {
|
6
|
+
MultifactorType[MultifactorType["EMAIL"] = 1] = "EMAIL";
|
7
|
+
MultifactorType[MultifactorType["APP"] = 2] = "APP";
|
8
|
+
})(MultifactorType || (exports.MultifactorType = MultifactorType = {}));
|
9
|
+
//# sourceMappingURL=multifactor-type.enum.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"multifactor-type.enum.js","sourceRoot":"","sources":["../../../../src/auth/src/enums/multifactor-type.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,uDAAS,CAAA;IACT,mDAAO,CAAA;AACT,CAAC,EAHW,eAAe,+BAAf,eAAe,QAG1B"}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { CanActivate, ExecutionContext } from '@nestjs/common';
|
2
|
+
import { Reflector } from '@nestjs/core';
|
3
|
+
import { AuthService } from '../auth.service';
|
4
|
+
export declare class AuthGuard implements CanActivate {
|
5
|
+
private auth;
|
6
|
+
private reflector;
|
7
|
+
constructor(auth: AuthService, reflector: Reflector);
|
8
|
+
canActivate(context: ExecutionContext): Promise<boolean>;
|
9
|
+
private extractTokenFromHeader;
|
10
|
+
}
|
11
|
+
//# sourceMappingURL=auth.guard.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"auth.guard.d.ts","sourceRoot":"","sources":["../../../../src/auth/src/guards/auth.guard.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,gBAAgB,EAGjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG9C,qBACa,SAAU,YAAW,WAAW;IAEzC,OAAO,CAAC,IAAI;IACZ,OAAO,CAAC,SAAS;gBADT,IAAI,EAAE,WAAW,EACjB,SAAS,EAAE,SAAS;IAGxB,WAAW,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC;IAyB9D,OAAO,CAAC,sBAAsB;CAI/B"}
|
@@ -0,0 +1,56 @@
|
|
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.AuthGuard = void 0;
|
13
|
+
const common_1 = require("@nestjs/common");
|
14
|
+
const core_1 = require("@nestjs/core");
|
15
|
+
const auth_service_1 = require("../auth.service");
|
16
|
+
const public_decorator_1 = require("../decorators/public.decorator");
|
17
|
+
let AuthGuard = class AuthGuard {
|
18
|
+
constructor(auth, reflector) {
|
19
|
+
this.auth = auth;
|
20
|
+
this.reflector = reflector;
|
21
|
+
}
|
22
|
+
async canActivate(context) {
|
23
|
+
const isPublic = this.reflector.getAllAndOverride(public_decorator_1.IS_PUBLIC_KEY, [
|
24
|
+
context.getHandler(),
|
25
|
+
context.getClass(),
|
26
|
+
]);
|
27
|
+
if (isPublic) {
|
28
|
+
return true;
|
29
|
+
}
|
30
|
+
const request = context.switchToHttp().getRequest();
|
31
|
+
const token = this.extractTokenFromHeader(request);
|
32
|
+
if (!token) {
|
33
|
+
throw new common_1.UnauthorizedException();
|
34
|
+
}
|
35
|
+
try {
|
36
|
+
const payload = await this.auth.verifyToken(token);
|
37
|
+
request['auth'] = payload;
|
38
|
+
}
|
39
|
+
catch (_a) {
|
40
|
+
throw new common_1.UnauthorizedException();
|
41
|
+
}
|
42
|
+
return true;
|
43
|
+
}
|
44
|
+
extractTokenFromHeader(request) {
|
45
|
+
var _a, _b;
|
46
|
+
const [type, token] = (_b = (_a = request.headers.authorization) === null || _a === void 0 ? void 0 : _a.split(' ')) !== null && _b !== void 0 ? _b : [];
|
47
|
+
return type === 'Bearer' ? token : undefined;
|
48
|
+
}
|
49
|
+
};
|
50
|
+
exports.AuthGuard = AuthGuard;
|
51
|
+
exports.AuthGuard = AuthGuard = __decorate([
|
52
|
+
(0, common_1.Injectable)(),
|
53
|
+
__metadata("design:paramtypes", [auth_service_1.AuthService,
|
54
|
+
core_1.Reflector])
|
55
|
+
], AuthGuard);
|
56
|
+
//# sourceMappingURL=auth.guard.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"auth.guard.js","sourceRoot":"","sources":["../../../../src/auth/src/guards/auth.guard.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAKwB;AACxB,uCAAyC;AAEzC,kDAA8C;AAC9C,qEAA+D;AAGxD,IAAM,SAAS,GAAf,MAAM,SAAS;IACpB,YACU,IAAiB,EACjB,SAAoB;QADpB,SAAI,GAAJ,IAAI,CAAa;QACjB,cAAS,GAAT,SAAS,CAAW;IAC3B,CAAC;IAEJ,KAAK,CAAC,WAAW,CAAC,OAAyB;QACzC,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAU,gCAAa,EAAE;YACxE,OAAO,CAAC,UAAU,EAAE;YACpB,OAAO,CAAC,QAAQ,EAAE;SACnB,CAAC,CAAC;QACH,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,OAAO,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC;QACpD,MAAM,KAAK,GAAG,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC;QAEnD,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,IAAI,8BAAqB,EAAE,CAAC;QACpC,CAAC;QACD,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;YAEnD,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC;QAC5B,CAAC;QAAC,WAAM,CAAC;YACP,MAAM,IAAI,8BAAqB,EAAE,CAAC;QACpC,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAEO,sBAAsB,CAAC,OAAgB;;QAC7C,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,MAAA,MAAA,OAAO,CAAC,OAAO,CAAC,aAAa,0CAAE,KAAK,CAAC,GAAG,CAAC,mCAAI,EAAE,CAAC;QACtE,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IAC/C,CAAC;CACF,CAAA;AAnCY,8BAAS;oBAAT,SAAS;IADrB,IAAA,mBAAU,GAAE;qCAGK,0BAAW;QACN,gBAAS;GAHnB,SAAS,CAmCrB"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/auth/src/migrations/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,WAAW,EAGZ,MAAM,SAAS,CAAC;AAIjB,qBAAa,OAAQ,YAAW,kBAAkB;IAC1C,EAAE,CAAC,WAAW,EAAE,WAAW;IA4F3B,IAAI,CAAC,WAAW,EAAE,WAAW;CAIpC"}
|
@@ -0,0 +1,121 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
+
}) : function(o, v) {
|
16
|
+
o["default"] = v;
|
17
|
+
});
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
+
if (mod && mod.__esModule) return mod;
|
20
|
+
var result = {};
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
+
__setModuleDefault(result, mod);
|
23
|
+
return result;
|
24
|
+
};
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
+
exports.Migrate = void 0;
|
27
|
+
const typeorm_1 = require("typeorm");
|
28
|
+
const utils_1 = require("@hedhog/utils");
|
29
|
+
const bcrypt = __importStar(require("bcrypt"));
|
30
|
+
class Migrate {
|
31
|
+
async up(queryRunner) {
|
32
|
+
await queryRunner.createTable(new typeorm_1.Table({
|
33
|
+
name: 'multifactors',
|
34
|
+
columns: [
|
35
|
+
(0, utils_1.idColumn)(),
|
36
|
+
{
|
37
|
+
name: 'name',
|
38
|
+
type: 'varchar',
|
39
|
+
},
|
40
|
+
(0, utils_1.timestampColumn)(),
|
41
|
+
(0, utils_1.timestampColumn)('updated_at'),
|
42
|
+
],
|
43
|
+
}));
|
44
|
+
await queryRunner.manager
|
45
|
+
.createQueryBuilder()
|
46
|
+
.insert()
|
47
|
+
.into('multifactors', ['name'])
|
48
|
+
.values([
|
49
|
+
{
|
50
|
+
name: 'Email',
|
51
|
+
},
|
52
|
+
{
|
53
|
+
name: 'Applicativo',
|
54
|
+
},
|
55
|
+
])
|
56
|
+
.execute();
|
57
|
+
await queryRunner.createTable(new typeorm_1.Table({
|
58
|
+
name: 'users',
|
59
|
+
columns: [
|
60
|
+
(0, utils_1.idColumn)(),
|
61
|
+
{
|
62
|
+
name: 'name',
|
63
|
+
type: 'varchar',
|
64
|
+
},
|
65
|
+
{
|
66
|
+
name: 'email',
|
67
|
+
type: 'varchar',
|
68
|
+
},
|
69
|
+
{
|
70
|
+
name: 'password',
|
71
|
+
type: 'varchar',
|
72
|
+
},
|
73
|
+
{
|
74
|
+
name: 'multifactor_id',
|
75
|
+
type: 'int',
|
76
|
+
isNullable: true,
|
77
|
+
unsigned: true,
|
78
|
+
},
|
79
|
+
{
|
80
|
+
name: 'code',
|
81
|
+
type: 'varchar',
|
82
|
+
isNullable: true,
|
83
|
+
},
|
84
|
+
(0, utils_1.timestampColumn)(),
|
85
|
+
(0, utils_1.timestampColumn)('updated_at'),
|
86
|
+
],
|
87
|
+
}));
|
88
|
+
await queryRunner.createForeignKeys('users', [
|
89
|
+
new typeorm_1.TableForeignKey({
|
90
|
+
columnNames: ['multifactor_id'],
|
91
|
+
referencedColumnNames: ['id'],
|
92
|
+
referencedTableName: 'multifactors',
|
93
|
+
name: 'fk_users_to_multifactors_on_multifactor_id',
|
94
|
+
onDelete: 'Cascade',
|
95
|
+
}),
|
96
|
+
]);
|
97
|
+
await queryRunner.manager
|
98
|
+
.createQueryBuilder()
|
99
|
+
.insert()
|
100
|
+
.into('users', ['name', 'email', 'password'])
|
101
|
+
.values([
|
102
|
+
{
|
103
|
+
name: 'Superuser',
|
104
|
+
email: 'root@hedhog.com',
|
105
|
+
password: await bcrypt.hash(`hedhog`, 12),
|
106
|
+
},
|
107
|
+
{
|
108
|
+
name: 'User',
|
109
|
+
email: 'user@hedhog.com',
|
110
|
+
password: await bcrypt.hash(`hedhog`, 12),
|
111
|
+
},
|
112
|
+
])
|
113
|
+
.execute();
|
114
|
+
}
|
115
|
+
async down(queryRunner) {
|
116
|
+
await queryRunner.dropTable('multifactors');
|
117
|
+
await queryRunner.dropTable('users');
|
118
|
+
}
|
119
|
+
}
|
120
|
+
exports.Migrate = Migrate;
|
121
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/auth/src/migrations/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAKiB;AACjB,yCAA0D;AAC1D,+CAAiC;AAEjC,MAAa,OAAO;IAClB,KAAK,CAAC,EAAE,CAAC,WAAwB;QAC/B,MAAM,WAAW,CAAC,WAAW,CAC3B,IAAI,eAAK,CAAC;YACR,IAAI,EAAE,cAAc;YACpB,OAAO,EAAE;gBACP,IAAA,gBAAQ,GAAE;gBACV;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,SAAS;iBAChB;gBACD,IAAA,uBAAe,GAAE;gBACjB,IAAA,uBAAe,EAAC,YAAY,CAAC;aAC9B;SACF,CAAC,CACH,CAAC;QAEF,MAAM,WAAW,CAAC,OAAO;aACtB,kBAAkB,EAAE;aACpB,MAAM,EAAE;aACR,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,CAAC,CAAC;aAC9B,MAAM,CAAC;YACN;gBACE,IAAI,EAAE,OAAO;aACd;YACD;gBACE,IAAI,EAAE,aAAa;aACpB;SACF,CAAC;aACD,OAAO,EAAE,CAAC;QAEb,MAAM,WAAW,CAAC,WAAW,CAC3B,IAAI,eAAK,CAAC;YACR,IAAI,EAAE,OAAO;YACb,OAAO,EAAE;gBACP,IAAA,gBAAQ,GAAE;gBACV;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,SAAS;iBAChB;gBACD;oBACE,IAAI,EAAE,OAAO;oBACb,IAAI,EAAE,SAAS;iBAChB;gBACD;oBACE,IAAI,EAAE,UAAU;oBAChB,IAAI,EAAE,SAAS;iBAChB;gBACD;oBACE,IAAI,EAAE,gBAAgB;oBACtB,IAAI,EAAE,KAAK;oBACX,UAAU,EAAE,IAAI;oBAChB,QAAQ,EAAE,IAAI;iBACf;gBACD;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,SAAS;oBACf,UAAU,EAAE,IAAI;iBACjB;gBACD,IAAA,uBAAe,GAAE;gBACjB,IAAA,uBAAe,EAAC,YAAY,CAAC;aAC9B;SACF,CAAC,CACH,CAAC;QAEF,MAAM,WAAW,CAAC,iBAAiB,CAAC,OAAO,EAAE;YAC3C,IAAI,yBAAe,CAAC;gBAClB,WAAW,EAAE,CAAC,gBAAgB,CAAC;gBAC/B,qBAAqB,EAAE,CAAC,IAAI,CAAC;gBAC7B,mBAAmB,EAAE,cAAc;gBACnC,IAAI,EAAE,4CAA4C;gBAClD,QAAQ,EAAE,SAAS;aACpB,CAAC;SACH,CAAC,CAAC;QAEH,MAAM,WAAW,CAAC,OAAO;aACtB,kBAAkB,EAAE;aACpB,MAAM,EAAE;aACR,IAAI,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;aAC5C,MAAM,CAAC;YACN;gBACE,IAAI,EAAE,WAAW;gBACjB,KAAK,EAAE,iBAAiB;gBACxB,QAAQ,EAAE,MAAM,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC;aAC1C;YACD;gBACE,IAAI,EAAE,MAAM;gBACZ,KAAK,EAAE,iBAAiB;gBACxB,QAAQ,EAAE,MAAM,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC;aAC1C;SACF,CAAC;aACD,OAAO,EAAE,CAAC;IACf,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,WAAwB;QACjC,MAAM,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;QAC5C,MAAM,WAAW,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACvC,CAAC;CACF;AAjGD,0BAiGC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"user.type.d.ts","sourceRoot":"","sources":["../../../../src/auth/src/types/user.type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,IAAI,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"user.type.js","sourceRoot":"","sources":["../../../../src/auth/src/types/user.type.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"delete.dto.d.ts","sourceRoot":"","sources":["../../../../src/file/src/dto/delete.dto.ts"],"names":[],"mappings":"AAEA,qBAAa,SAAS;IAIpB,GAAG,EAAE,MAAM,EAAE,CAAC;CACf"}
|
@@ -0,0 +1,23 @@
|
|
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
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"delete.dto.js","sourceRoot":"","sources":["../../../../src/file/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"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"file.module.d.ts","sourceRoot":"","sources":["../../../src/file/src/file.module.ts"],"names":[],"mappings":"AAMA,qBASa,UAAU;CAAG"}
|
@@ -0,0 +1,29 @@
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
9
|
+
exports.FileModule = void 0;
|
10
|
+
const common_1 = require("@nestjs/common");
|
11
|
+
const file_service_1 = require("./file.service");
|
12
|
+
const __1 = require("../../");
|
13
|
+
const prisma_1 = require("@hedhog/prisma");
|
14
|
+
const pagination_1 = require("@hedhog/pagination");
|
15
|
+
let FileModule = class FileModule {
|
16
|
+
};
|
17
|
+
exports.FileModule = FileModule;
|
18
|
+
exports.FileModule = FileModule = __decorate([
|
19
|
+
(0, common_1.Module)({
|
20
|
+
imports: [
|
21
|
+
(0, common_1.forwardRef)(() => __1.AuthModule),
|
22
|
+
(0, common_1.forwardRef)(() => prisma_1.PrismaModule),
|
23
|
+
(0, common_1.forwardRef)(() => pagination_1.PaginationModule),
|
24
|
+
],
|
25
|
+
providers: [file_service_1.FileService],
|
26
|
+
exports: [file_service_1.FileService],
|
27
|
+
})
|
28
|
+
], FileModule);
|
29
|
+
//# sourceMappingURL=file.module.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"file.module.js","sourceRoot":"","sources":["../../../src/file/src/file.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAoD;AACpD,iDAA6C;AAC7C,8BAAoC;AACpC,2CAA8C;AAC9C,mDAAsD;AAW/C,IAAM,UAAU,GAAhB,MAAM,UAAU;CAAG,CAAA;AAAb,gCAAU;qBAAV,UAAU;IATtB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,cAAU,CAAC;YAC5B,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,qBAAY,CAAC;YAC9B,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,6BAAgB,CAAC;SACnC;QACD,SAAS,EAAE,CAAC,0BAAW,CAAC;QACxB,OAAO,EAAE,CAAC,0BAAW,CAAC;KACvB,CAAC;GACW,UAAU,CAAG"}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { PaginationDTO, PaginationService } from '@hedhog/pagination';
|
2
|
+
import { PrismaService } from '@hedhog/prisma';
|
3
|
+
import { DeleteDTO } from './dto/delete.dto';
|
4
|
+
export declare class FileService {
|
5
|
+
private readonly prismaService;
|
6
|
+
private readonly paginationService;
|
7
|
+
constructor(prismaService: PrismaService, paginationService: PaginationService);
|
8
|
+
getFiles(paginationParams: PaginationDTO): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
|
9
|
+
get(fileId: number): Promise<any>;
|
10
|
+
delete({ ids }: DeleteDTO): Promise<any>;
|
11
|
+
}
|
12
|
+
//# sourceMappingURL=file.service.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"file.service.d.ts","sourceRoot":"","sources":["../../../src/file/src/file.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAO/C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,qBACa,WAAW;IAGpB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAE9B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;gBAFjB,aAAa,EAAE,aAAa,EAE5B,iBAAiB,EAAE,iBAAiB;IAGjD,QAAQ,CAAC,gBAAgB,EAAE,aAAa;IAkBxC,GAAG,CAAC,MAAM,EAAE,MAAM;IAMlB,MAAM,CAAC,EAAE,GAAG,EAAE,EAAE,SAAS;CAehC"}
|
@@ -0,0 +1,59 @@
|
|
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
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
13
|
+
};
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
+
exports.FileService = void 0;
|
16
|
+
const pagination_1 = require("@hedhog/pagination");
|
17
|
+
const prisma_1 = require("@hedhog/prisma");
|
18
|
+
const common_1 = require("@nestjs/common");
|
19
|
+
let FileService = class FileService {
|
20
|
+
constructor(prismaService, paginationService) {
|
21
|
+
this.prismaService = prismaService;
|
22
|
+
this.paginationService = paginationService;
|
23
|
+
}
|
24
|
+
async getFiles(paginationParams) {
|
25
|
+
const fields = ['name', 'url', 'extension'];
|
26
|
+
const OR = this.prismaService.createInsensitiveSearch(fields, paginationParams);
|
27
|
+
return this.paginationService.paginate(this.prismaService.files, paginationParams, {
|
28
|
+
where: {
|
29
|
+
OR,
|
30
|
+
},
|
31
|
+
});
|
32
|
+
}
|
33
|
+
async get(fileId) {
|
34
|
+
return this.prismaService.files.findUnique({
|
35
|
+
where: { id: fileId },
|
36
|
+
});
|
37
|
+
}
|
38
|
+
async delete({ ids }) {
|
39
|
+
if (ids == undefined || ids == null) {
|
40
|
+
throw new common_1.BadRequestException(`You must select at least one file to delete.`);
|
41
|
+
}
|
42
|
+
return this.prismaService.files.deleteMany({
|
43
|
+
where: {
|
44
|
+
id: {
|
45
|
+
in: ids,
|
46
|
+
},
|
47
|
+
},
|
48
|
+
});
|
49
|
+
}
|
50
|
+
};
|
51
|
+
exports.FileService = FileService;
|
52
|
+
exports.FileService = FileService = __decorate([
|
53
|
+
(0, common_1.Injectable)(),
|
54
|
+
__param(0, (0, common_1.Inject)((0, common_1.forwardRef)(() => prisma_1.PrismaService))),
|
55
|
+
__param(1, (0, common_1.Inject)((0, common_1.forwardRef)(() => pagination_1.PaginationService))),
|
56
|
+
__metadata("design:paramtypes", [prisma_1.PrismaService,
|
57
|
+
pagination_1.PaginationService])
|
58
|
+
], FileService);
|
59
|
+
//# sourceMappingURL=file.service.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"file.service.js","sourceRoot":"","sources":["../../../src/file/src/file.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mDAAsE;AACtE,2CAA+C;AAC/C,2CAKwB;AAIjB,IAAM,WAAW,GAAjB,MAAM,WAAW;IACtB,YAEmB,aAA4B,EAE5B,iBAAoC;QAFpC,kBAAa,GAAb,aAAa,CAAe;QAE5B,sBAAiB,GAAjB,iBAAiB,CAAmB;IACpD,CAAC;IAEJ,KAAK,CAAC,QAAQ,CAAC,gBAA+B;QAC5C,MAAM,MAAM,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;QAC5C,MAAM,EAAE,GAAG,IAAI,CAAC,aAAa,CAAC,uBAAuB,CACnD,MAAM,EACN,gBAAgB,CACjB,CAAC;QAEF,OAAO,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CACpC,IAAI,CAAC,aAAa,CAAC,KAAK,EACxB,gBAAgB,EAChB;YACE,KAAK,EAAE;gBACL,EAAE;aACH;SACF,CACF,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,MAAc;QACtB,OAAO,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,UAAU,CAAC;YACzC,KAAK,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE;SACtB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAE,GAAG,EAAa;QAC7B,IAAI,GAAG,IAAI,SAAS,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;YACpC,MAAM,IAAI,4BAAmB,CAC3B,8CAA8C,CAC/C,CAAC;QACJ,CAAC;QAED,OAAO,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,UAAU,CAAC;YACzC,KAAK,EAAE;gBACL,EAAE,EAAE;oBACF,EAAE,EAAE,GAAG;iBACR;aACF;SACF,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AA/CY,kCAAW;sBAAX,WAAW;IADvB,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,sBAAa,CAAC,CAAC,CAAA;IAEvC,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,8BAAiB,CAAC,CAAC,CAAA;qCADZ,sBAAa;QAET,8BAAiB;GAL5C,WAAW,CA+CvB"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/file/src/migrations/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAS,MAAM,SAAS,CAAC;AAGjE,qBAAa,OAAQ,YAAW,kBAAkB;IACnC,EAAE,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IA0I3C,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CAG3D"}
|
@@ -0,0 +1,137 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.Migrate = void 0;
|
4
|
+
const typeorm_1 = require("typeorm");
|
5
|
+
const utils_1 = require("@hedhog/utils");
|
6
|
+
class Migrate {
|
7
|
+
async up(queryRunner) {
|
8
|
+
await queryRunner.createTable(new typeorm_1.Table({
|
9
|
+
name: 'files',
|
10
|
+
columns: [
|
11
|
+
(0, utils_1.idColumn)(),
|
12
|
+
{
|
13
|
+
name: 'name',
|
14
|
+
type: 'varchar',
|
15
|
+
},
|
16
|
+
{
|
17
|
+
name: 'url',
|
18
|
+
type: 'varchar',
|
19
|
+
},
|
20
|
+
{
|
21
|
+
name: 'extension',
|
22
|
+
type: 'varchar',
|
23
|
+
length: '15',
|
24
|
+
},
|
25
|
+
{
|
26
|
+
name: 'bytes',
|
27
|
+
type: 'int',
|
28
|
+
},
|
29
|
+
(0, utils_1.timestampColumn)(),
|
30
|
+
(0, utils_1.timestampColumn)('updated_at'),
|
31
|
+
],
|
32
|
+
}));
|
33
|
+
await queryRunner.manager
|
34
|
+
.createQueryBuilder()
|
35
|
+
.insert()
|
36
|
+
.into('settings')
|
37
|
+
.values([
|
38
|
+
{ name: 'Storage Provider' },
|
39
|
+
{ name: 'AWS Storage' },
|
40
|
+
{ name: 'Azure Storage' },
|
41
|
+
])
|
42
|
+
.execute();
|
43
|
+
const rows = await queryRunner.manager
|
44
|
+
.createQueryBuilder()
|
45
|
+
.select('*')
|
46
|
+
.from('settings', 's')
|
47
|
+
.where('s.name IN (:...names)', {
|
48
|
+
names: ['Storage Provider', 'AWS Storage', 'Azure Storage'],
|
49
|
+
})
|
50
|
+
.getRawMany();
|
51
|
+
for (const row of rows) {
|
52
|
+
switch (row.name) {
|
53
|
+
case 'AWS Storage':
|
54
|
+
await queryRunner.manager
|
55
|
+
.createQueryBuilder()
|
56
|
+
.insert()
|
57
|
+
.into('setting_values')
|
58
|
+
.values([
|
59
|
+
{
|
60
|
+
value: '',
|
61
|
+
name: 'ACCESS_KEY_ID',
|
62
|
+
description: 'Chave pública usada para identificar o usuário ou serviço que realiza chamadas à API da AWS, sendo necessária para autenticação junto com o AWS_SECRET_ACCESS_KEY.',
|
63
|
+
label: 'ID da chave de acesso',
|
64
|
+
setting_id: row.id,
|
65
|
+
},
|
66
|
+
{
|
67
|
+
value: '',
|
68
|
+
name: 'SECRET_ACCESS_KEY',
|
69
|
+
description: 'Chave secreta de acesso para autenticação segura em serviços da AWS.',
|
70
|
+
label: 'Chave Secreta de Acesso',
|
71
|
+
setting_id: row.id,
|
72
|
+
},
|
73
|
+
{
|
74
|
+
value: '',
|
75
|
+
name: 'BUCKET_NAME',
|
76
|
+
description: 'Nome do bucket de armazenamento na AWS.',
|
77
|
+
label: 'Nome do Bucket',
|
78
|
+
setting_id: row.id,
|
79
|
+
},
|
80
|
+
])
|
81
|
+
.execute();
|
82
|
+
break;
|
83
|
+
case 'Azure Storage':
|
84
|
+
await queryRunner.manager
|
85
|
+
.createQueryBuilder()
|
86
|
+
.insert()
|
87
|
+
.into('setting_values')
|
88
|
+
.values([
|
89
|
+
{
|
90
|
+
value: '',
|
91
|
+
name: 'ACCOUNT_NAME',
|
92
|
+
description: 'Nome da conta de armazenamento no Azure.',
|
93
|
+
label: 'Nome da Conta de Armazenamento',
|
94
|
+
setting_id: row.id,
|
95
|
+
},
|
96
|
+
{
|
97
|
+
value: '',
|
98
|
+
name: 'ACCOUNT_KEY',
|
99
|
+
description: 'Chave de acesso para autenticação e gerenciamento da conta de armazenamento.',
|
100
|
+
label: 'Chave da Conta de Armazenamento',
|
101
|
+
setting_id: row.id,
|
102
|
+
},
|
103
|
+
{
|
104
|
+
value: '',
|
105
|
+
name: 'CONTAINER_NAME',
|
106
|
+
description: 'Nome do contêiner dentro da conta de armazenamento.',
|
107
|
+
label: 'Nome do Container',
|
108
|
+
setting_id: row.id,
|
109
|
+
},
|
110
|
+
])
|
111
|
+
.execute();
|
112
|
+
break;
|
113
|
+
case 'Storage Provider':
|
114
|
+
await queryRunner.manager
|
115
|
+
.createQueryBuilder()
|
116
|
+
.insert()
|
117
|
+
.into('setting_values')
|
118
|
+
.values([
|
119
|
+
{
|
120
|
+
value: '',
|
121
|
+
name: 'STORAGE_PROVIDER',
|
122
|
+
description: 'Escolha entre AWS e Azure como provedor de armazenamento e forneça as informações correspondentes.',
|
123
|
+
label: 'Provedor de armazenamento',
|
124
|
+
setting_id: row.id,
|
125
|
+
},
|
126
|
+
])
|
127
|
+
.execute();
|
128
|
+
break;
|
129
|
+
}
|
130
|
+
}
|
131
|
+
}
|
132
|
+
async down(queryRunner) {
|
133
|
+
await queryRunner.dropTable('files');
|
134
|
+
}
|
135
|
+
}
|
136
|
+
exports.Migrate = Migrate;
|
137
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/file/src/migrations/index.ts"],"names":[],"mappings":"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"}
|
package/dist/index.d.ts
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
export * from './admin.module';
|
2
|
+
export * from './auth/src/auth.module';
|
3
|
+
export * from './auth/src/auth.service';
|
4
|
+
export * from './auth/src/decorators/public.decorator';
|
5
|
+
export * from './auth/src/decorators/user.decorator';
|
6
|
+
export * from './auth/src/guards/auth.guard';
|
7
|
+
export * from './file/src/file.module';
|
8
|
+
export * from './file/src/file.service';
|
9
|
+
export * from './mail/src/enums/mail-configuration-type.enum';
|
10
|
+
export * from './mail/src/interfaces';
|
11
|
+
export * from './mail/src/mail.module';
|
12
|
+
export * from './mail/src/mail.service';
|
13
|
+
export * from './menu/src/menu.module';
|
14
|
+
export * from './menu/src/menu.service';
|
15
|
+
export * from './permission/src/permission.module';
|
16
|
+
export * from './permission/src/permission.service';
|
17
|
+
export * from './permission/src/types/permission.types';
|
18
|
+
export * from './permission/src/decorators/permission.decorator';
|
19
|
+
export * from './screen/src/screen.module';
|
20
|
+
export * from './screen/src/screen.service';
|
21
|
+
export * from './setting/src/settings.module';
|
22
|
+
export * from './setting/src/settings.service';
|
23
|
+
export * from './user/src/constants/user.constants';
|
24
|
+
export * from './user/src/user.module';
|
25
|
+
export * from './user/src/user.service';
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,gBAAgB,CAAC;AAG/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wCAAwC,CAAC;AACvD,cAAc,sCAAsC,CAAC;AACrD,cAAc,8BAA8B,CAAC;AAG7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AAGxC,cAAc,+CAA+C,CAAC;AAC9D,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AAGxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AAGxC,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,yCAAyC,CAAC;AACxD,cAAc,kDAAkD,CAAC;AAGjE,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAG5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC;AAG/C,cAAc,qCAAqC,CAAC;AACpD,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC"}
|