@hedhog/admin 0.0.2 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +3 -0
- package/dist/index.js +12 -16
- package/package.json +32 -29
- package/src/migrations/migrate-01.ts +107 -0
- package/src/migrations/migrate-02.ts +40 -0
- package/src/migrations/{1726795818403-migrate.ts → migrate-03.ts} +49 -49
- package/src/migrations/{1726795828359-migrate.ts → migrate-04.ts} +1 -1
- 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/file/src/dto/delete.dto.d.ts +0 -4
- package/dist/file/src/dto/delete.dto.d.ts.map +0 -1
- package/dist/file/src/dto/delete.dto.js +0 -23
- package/dist/file/src/dto/delete.dto.js.map +0 -1
- package/dist/file/src/file.module.d.ts +0 -3
- package/dist/file/src/file.module.d.ts.map +0 -1
- package/dist/file/src/file.module.js +0 -29
- package/dist/file/src/file.module.js.map +0 -1
- package/dist/file/src/file.service.d.ts +0 -12
- package/dist/file/src/file.service.d.ts.map +0 -1
- package/dist/file/src/file.service.js +0 -59
- package/dist/file/src/file.service.js.map +0 -1
- package/dist/file/src/migrations/index.d.ts +0 -6
- package/dist/file/src/migrations/index.d.ts.map +0 -1
- package/dist/file/src/migrations/index.js +0 -137
- package/dist/file/src/migrations/index.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/mail/src/enums/mail-configuration-type.enum.d.ts +0 -6
- package/dist/mail/src/enums/mail-configuration-type.enum.d.ts.map +0 -1
- package/dist/mail/src/enums/mail-configuration-type.enum.js +0 -10
- package/dist/mail/src/enums/mail-configuration-type.enum.js.map +0 -1
- package/dist/mail/src/interfaces/index.d.ts +0 -3
- package/dist/mail/src/interfaces/index.d.ts.map +0 -1
- package/dist/mail/src/interfaces/index.js +0 -19
- package/dist/mail/src/interfaces/index.js.map +0 -1
- package/dist/mail/src/interfaces/mail-module-options.interface.d.ts +0 -32
- package/dist/mail/src/interfaces/mail-module-options.interface.d.ts.map +0 -1
- package/dist/mail/src/interfaces/mail-module-options.interface.js +0 -3
- package/dist/mail/src/interfaces/mail-module-options.interface.js.map +0 -1
- package/dist/mail/src/interfaces/mail-type.d.ts +0 -13
- package/dist/mail/src/interfaces/mail-type.d.ts.map +0 -1
- package/dist/mail/src/interfaces/mail-type.js +0 -3
- package/dist/mail/src/interfaces/mail-type.js.map +0 -1
- package/dist/mail/src/mail.consts.d.ts +0 -17
- package/dist/mail/src/mail.consts.d.ts.map +0 -1
- package/dist/mail/src/mail.consts.js +0 -5
- package/dist/mail/src/mail.consts.js.map +0 -1
- package/dist/mail/src/mail.module.d.ts +0 -8
- package/dist/mail/src/mail.module.d.ts.map +0 -1
- package/dist/mail/src/mail.module.js +0 -51
- package/dist/mail/src/mail.module.js.map +0 -1
- package/dist/mail/src/mail.service.d.ts +0 -14
- package/dist/mail/src/mail.service.d.ts.map +0 -1
- package/dist/mail/src/mail.service.js +0 -281
- package/dist/mail/src/mail.service.js.map +0 -1
- package/dist/mail/src/mail.service.spec.d.ts +0 -2
- package/dist/mail/src/mail.service.spec.d.ts.map +0 -1
- package/dist/mail/src/mail.service.spec.js +0 -17
- package/dist/mail/src/mail.service.spec.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/1726795702341-migrate.d.ts +0 -6
- package/dist/migrations/1726795702341-migrate.d.ts.map +0 -1
- package/dist/migrations/1726795702341-migrate.js +0 -121
- package/dist/migrations/1726795702341-migrate.js.map +0 -1
- package/dist/migrations/1726795734665-migrate.d.ts +0 -6
- package/dist/migrations/1726795734665-migrate.d.ts.map +0 -1
- package/dist/migrations/1726795734665-migrate.js +0 -40
- package/dist/migrations/1726795734665-migrate.js.map +0 -1
- package/dist/migrations/1726795818403-migrate.d.ts +0 -7
- package/dist/migrations/1726795818403-migrate.d.ts.map +0 -1
- package/dist/migrations/1726795818403-migrate.js +0 -101
- package/dist/migrations/1726795818403-migrate.js.map +0 -1
- package/dist/migrations/1726795828359-migrate.d.ts +0 -6
- package/dist/migrations/1726795828359-migrate.d.ts.map +0 -1
- package/dist/migrations/1726795828359-migrate.js +0 -525
- package/dist/migrations/1726795828359-migrate.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/setting/src/dto/create.dto.d.ts +0 -4
- package/dist/setting/src/dto/create.dto.d.ts.map +0 -1
- package/dist/setting/src/dto/create.dto.js +0 -22
- package/dist/setting/src/dto/create.dto.js.map +0 -1
- package/dist/setting/src/dto/delete.dto.d.ts +0 -4
- package/dist/setting/src/dto/delete.dto.d.ts.map +0 -1
- package/dist/setting/src/dto/delete.dto.js +0 -23
- package/dist/setting/src/dto/delete.dto.js.map +0 -1
- package/dist/setting/src/dto/update.dto.d.ts +0 -4
- package/dist/setting/src/dto/update.dto.d.ts.map +0 -1
- package/dist/setting/src/dto/update.dto.js +0 -8
- package/dist/setting/src/dto/update.dto.js.map +0 -1
- package/dist/setting/src/migrations/index.d.ts +0 -6
- package/dist/setting/src/migrations/index.d.ts.map +0 -1
- package/dist/setting/src/migrations/index.js +0 -67
- package/dist/setting/src/migrations/index.js.map +0 -1
- package/dist/setting/src/settings.controller.d.ts +0 -14
- package/dist/setting/src/settings.controller.d.ts.map +0 -1
- package/dist/setting/src/settings.controller.js +0 -94
- package/dist/setting/src/settings.controller.js.map +0 -1
- package/dist/setting/src/settings.module.d.ts +0 -3
- package/dist/setting/src/settings.module.d.ts.map +0 -1
- package/dist/setting/src/settings.module.js +0 -31
- package/dist/setting/src/settings.module.js.map +0 -1
- package/dist/setting/src/settings.service.d.ts +0 -19
- package/dist/setting/src/settings.service.d.ts.map +0 -1
- package/dist/setting/src/settings.service.js +0 -70
- package/dist/setting/src/settings.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
- package/src/migrations/1726795702341-migrate.ts +0 -107
- package/src/migrations/1726795734665-migrate.ts +0 -40
@@ -1,50 +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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
9
|
-
exports.AuthModule = void 0;
|
10
|
-
const common_1 = require("@nestjs/common");
|
11
|
-
const auth_service_1 = require("./auth.service");
|
12
|
-
const auth_controller_1 = require("./auth.controller");
|
13
|
-
const prisma_1 = require("@hedhog/prisma");
|
14
|
-
const jwt_1 = require("@nestjs/jwt");
|
15
|
-
const core_1 = require("@nestjs/core");
|
16
|
-
const auth_guard_1 = require("./guards/auth.guard");
|
17
|
-
const mail_1 = require("@hedhog/mail");
|
18
|
-
let AuthModule = class AuthModule {
|
19
|
-
};
|
20
|
-
exports.AuthModule = AuthModule;
|
21
|
-
exports.AuthModule = AuthModule = __decorate([
|
22
|
-
(0, common_1.Module)({
|
23
|
-
imports: [
|
24
|
-
(0, common_1.forwardRef)(() => jwt_1.JwtModule.registerAsync({
|
25
|
-
global: true,
|
26
|
-
useFactory: () => {
|
27
|
-
return {
|
28
|
-
secret: String(process.env.JWT_SECRET),
|
29
|
-
global: true,
|
30
|
-
signOptions: {
|
31
|
-
expiresIn: process.env.JWT_EXPIRES_IN || '30d',
|
32
|
-
},
|
33
|
-
};
|
34
|
-
},
|
35
|
-
})),
|
36
|
-
(0, common_1.forwardRef)(() => prisma_1.PrismaModule),
|
37
|
-
(0, common_1.forwardRef)(() => mail_1.MailModule),
|
38
|
-
],
|
39
|
-
controllers: [auth_controller_1.AuthController],
|
40
|
-
providers: [
|
41
|
-
auth_service_1.AuthService,
|
42
|
-
{
|
43
|
-
provide: core_1.APP_GUARD,
|
44
|
-
useClass: auth_guard_1.AuthGuard,
|
45
|
-
},
|
46
|
-
],
|
47
|
-
exports: [auth_service_1.AuthService],
|
48
|
-
})
|
49
|
-
], AuthModule);
|
50
|
-
//# sourceMappingURL=auth.module.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"auth.module.js","sourceRoot":"","sources":["../../../src/auth/src/auth.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAoD;AACpD,iDAA6C;AAC7C,uDAAmD;AACnD,2CAA8C;AAC9C,qCAAwC;AACxC,uCAAyC;AACzC,oDAAgD;AAChD,uCAA0C;AA+BnC,IAAM,UAAU,GAAhB,MAAM,UAAU;CAAG,CAAA;AAAb,gCAAU;qBAAV,UAAU;IA7BtB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,IAAA,mBAAU,EAAC,GAAG,EAAE,CACd,eAAS,CAAC,aAAa,CAAC;gBACtB,MAAM,EAAE,IAAI;gBACZ,UAAU,EAAE,GAAG,EAAE;oBACf,OAAO;wBACL,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC;wBACtC,MAAM,EAAE,IAAI;wBACZ,WAAW,EAAE;4BACX,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,KAAK;yBAC/C;qBACF,CAAC;gBACJ,CAAC;aACF,CAAC,CACH;YACD,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,qBAAY,CAAC;YAC9B,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,iBAAU,CAAC;SAC7B;QACD,WAAW,EAAE,CAAC,gCAAc,CAAC;QAC7B,SAAS,EAAE;YACT,0BAAW;YACX;gBACE,OAAO,EAAE,gBAAS;gBAClB,QAAQ,EAAE,sBAAS;aACpB;SACF;QACD,OAAO,EAAE,CAAC,0BAAW,CAAC;KACvB,CAAC;GACW,UAAU,CAAG"}
|
@@ -1,36 +0,0 @@
|
|
1
|
-
import { PrismaService } from '@hedhog/prisma';
|
2
|
-
import { JwtService } from '@nestjs/jwt';
|
3
|
-
import { ForgetDTO } from './dto/forget.dto';
|
4
|
-
import { LoginDTO } from './dto/login.dto';
|
5
|
-
import { OtpDTO } from './dto/otp.dto';
|
6
|
-
import { MailService } from '@hedhog/mail';
|
7
|
-
export declare class AuthService {
|
8
|
-
private readonly prisma;
|
9
|
-
private readonly jwt;
|
10
|
-
private readonly mail;
|
11
|
-
constructor(prisma: PrismaService, jwt: JwtService, mail: MailService);
|
12
|
-
verifyToken(token: string): Promise<any>;
|
13
|
-
generateRandomString(length: number): string;
|
14
|
-
generateRandomNumber(): number;
|
15
|
-
loginWithEmailAndPassword(email: string, password: string): Promise<{
|
16
|
-
token: string;
|
17
|
-
} | {
|
18
|
-
token: string;
|
19
|
-
mfa: boolean;
|
20
|
-
}>;
|
21
|
-
getToken(user: any): Promise<{
|
22
|
-
token: string;
|
23
|
-
}>;
|
24
|
-
forget({ email }: ForgetDTO): Promise<boolean>;
|
25
|
-
otp({ token, code }: OtpDTO): Promise<{
|
26
|
-
token: string;
|
27
|
-
}>;
|
28
|
-
login({ email, password }: LoginDTO): Promise<{
|
29
|
-
token: string;
|
30
|
-
} | {
|
31
|
-
token: string;
|
32
|
-
mfa: boolean;
|
33
|
-
}>;
|
34
|
-
verify(id: number): any;
|
35
|
-
}
|
36
|
-
//# sourceMappingURL=auth.service.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"auth.service.d.ts","sourceRoot":"","sources":["../../../src/auth/src/auth.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAO/C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,qBACa,WAAW;IAGpB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAEvB,OAAO,CAAC,QAAQ,CAAC,GAAG;IAEpB,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAJJ,MAAM,EAAE,aAAa,EAErB,GAAG,EAAE,UAAU,EAEf,IAAI,EAAE,WAAW;IAG9B,WAAW,CAAC,KAAK,EAAE,MAAM;IAM/B,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAW5C,oBAAoB,IAAI,MAAM;IAMxB,yBAAyB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;;;;;;IAgDzD,QAAQ,CAAC,IAAI,KAAA;;;IAUb,MAAM,CAAC,EAAE,KAAK,EAAE,EAAE,SAAS;IAkC3B,GAAG,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,MAAM;;;IA0BjC,KAAK,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,QAAQ;;;;;;IAInC,MAAM,CAAC,EAAE,EAAE,MAAM;CAGlB"}
|
@@ -1,162 +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
|
-
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.AuthService = void 0;
|
16
|
-
const prisma_1 = require("@hedhog/prisma");
|
17
|
-
const common_1 = require("@nestjs/common");
|
18
|
-
const jwt_1 = require("@nestjs/jwt");
|
19
|
-
const bcrypt_1 = require("bcrypt");
|
20
|
-
const multifactor_type_enum_1 = require("./enums/multifactor-type.enum");
|
21
|
-
const mail_1 = require("@hedhog/mail");
|
22
|
-
let AuthService = class AuthService {
|
23
|
-
constructor(prisma, jwt, mail) {
|
24
|
-
this.prisma = prisma;
|
25
|
-
this.jwt = jwt;
|
26
|
-
this.mail = mail;
|
27
|
-
}
|
28
|
-
async verifyToken(token) {
|
29
|
-
return this.jwt.verifyAsync(token, {
|
30
|
-
secret: String(process.env.JWT_SECRET),
|
31
|
-
});
|
32
|
-
}
|
33
|
-
generateRandomString(length) {
|
34
|
-
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
35
|
-
let result = '';
|
36
|
-
for (let i = 0; i < length; i++) {
|
37
|
-
const randomIndex = Math.floor(Math.random() * characters.length);
|
38
|
-
result += characters.charAt(randomIndex);
|
39
|
-
}
|
40
|
-
return result;
|
41
|
-
}
|
42
|
-
generateRandomNumber() {
|
43
|
-
const min = 100000;
|
44
|
-
const max = 999999;
|
45
|
-
return Math.floor(Math.random() * (max - min + 1)) + min;
|
46
|
-
}
|
47
|
-
async loginWithEmailAndPassword(email, password) {
|
48
|
-
const user = await this.prisma.users.findFirst({
|
49
|
-
where: {
|
50
|
-
email,
|
51
|
-
},
|
52
|
-
});
|
53
|
-
if (!user) {
|
54
|
-
throw new common_1.NotFoundException('User not found');
|
55
|
-
}
|
56
|
-
const isPasswordValid = await (0, bcrypt_1.compare)(password, user.password);
|
57
|
-
if (!isPasswordValid) {
|
58
|
-
throw new common_1.NotFoundException('Invalid password');
|
59
|
-
}
|
60
|
-
if (!user.multifactor_id) {
|
61
|
-
return this.getToken(user);
|
62
|
-
}
|
63
|
-
else {
|
64
|
-
if (user.multifactor_id === multifactor_type_enum_1.MultifactorType.EMAIL) {
|
65
|
-
const code = this.generateRandomNumber();
|
66
|
-
await this.prisma.users.update({
|
67
|
-
where: {
|
68
|
-
id: user.id,
|
69
|
-
},
|
70
|
-
data: {
|
71
|
-
code: String(code),
|
72
|
-
},
|
73
|
-
});
|
74
|
-
await this.mail.send({
|
75
|
-
to: user.email,
|
76
|
-
subject: 'Login code',
|
77
|
-
body: `Your login code is ${code}`,
|
78
|
-
});
|
79
|
-
}
|
80
|
-
return {
|
81
|
-
token: this.jwt.sign({
|
82
|
-
id: user.id,
|
83
|
-
mfa: user.multifactor_id,
|
84
|
-
}),
|
85
|
-
mfa: true,
|
86
|
-
};
|
87
|
-
}
|
88
|
-
}
|
89
|
-
async getToken(user) {
|
90
|
-
delete user.password;
|
91
|
-
const payload = { user };
|
92
|
-
return {
|
93
|
-
token: this.jwt.sign(payload),
|
94
|
-
};
|
95
|
-
}
|
96
|
-
async forget({ email }) {
|
97
|
-
const user = await this.prisma.users.findFirst({
|
98
|
-
where: {
|
99
|
-
email,
|
100
|
-
},
|
101
|
-
select: {
|
102
|
-
id: true,
|
103
|
-
},
|
104
|
-
});
|
105
|
-
if (!user) {
|
106
|
-
throw new common_1.NotFoundException('User not found');
|
107
|
-
}
|
108
|
-
const code = this.generateRandomString(32);
|
109
|
-
await this.prisma.users.update({
|
110
|
-
where: {
|
111
|
-
id: user.id,
|
112
|
-
},
|
113
|
-
data: {
|
114
|
-
code,
|
115
|
-
},
|
116
|
-
});
|
117
|
-
await this.mail.send({
|
118
|
-
to: email,
|
119
|
-
subject: 'Reset password',
|
120
|
-
body: `Reset your password by clicking <a href="${process.env.FRONTEND_URL}/reset-password/${code}">here</a>`,
|
121
|
-
});
|
122
|
-
return true;
|
123
|
-
}
|
124
|
-
async otp({ token, code }) {
|
125
|
-
const data = this.jwt.decode(token);
|
126
|
-
const user = await this.prisma.users.findFirst({
|
127
|
-
where: {
|
128
|
-
id: data['id'],
|
129
|
-
code: String(code),
|
130
|
-
},
|
131
|
-
});
|
132
|
-
if (!user) {
|
133
|
-
throw new common_1.NotFoundException('Invalid code');
|
134
|
-
}
|
135
|
-
await this.prisma.users.update({
|
136
|
-
where: {
|
137
|
-
id: user.id,
|
138
|
-
},
|
139
|
-
data: {
|
140
|
-
code: null,
|
141
|
-
},
|
142
|
-
});
|
143
|
-
return this.getToken(user);
|
144
|
-
}
|
145
|
-
login({ email, password }) {
|
146
|
-
return this.loginWithEmailAndPassword(email, password);
|
147
|
-
}
|
148
|
-
verify(id) {
|
149
|
-
return this.prisma.users.findUnique({ where: { id } });
|
150
|
-
}
|
151
|
-
};
|
152
|
-
exports.AuthService = AuthService;
|
153
|
-
exports.AuthService = AuthService = __decorate([
|
154
|
-
(0, common_1.Injectable)(),
|
155
|
-
__param(0, (0, common_1.Inject)((0, common_1.forwardRef)(() => prisma_1.PrismaService))),
|
156
|
-
__param(1, (0, common_1.Inject)((0, common_1.forwardRef)(() => jwt_1.JwtService))),
|
157
|
-
__param(2, (0, common_1.Inject)((0, common_1.forwardRef)(() => mail_1.MailService))),
|
158
|
-
__metadata("design:paramtypes", [prisma_1.PrismaService,
|
159
|
-
jwt_1.JwtService,
|
160
|
-
mail_1.MailService])
|
161
|
-
], AuthService);
|
162
|
-
//# sourceMappingURL=auth.service.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"auth.service.js","sourceRoot":"","sources":["../../../src/auth/src/auth.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA+C;AAC/C,2CAKwB;AACxB,qCAAyC;AACzC,mCAAiC;AAIjC,yEAAgE;AAChE,uCAA2C;AAGpC,IAAM,WAAW,GAAjB,MAAM,WAAW;IACtB,YAEmB,MAAqB,EAErB,GAAe,EAEf,IAAiB;QAJjB,WAAM,GAAN,MAAM,CAAe;QAErB,QAAG,GAAH,GAAG,CAAY;QAEf,SAAI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,CAAC,MAAM,CAAC;YAC7B,KAAK,EAAE;gBACL,EAAE,EAAE,IAAI,CAAC,EAAE;aACZ;YACD,IAAI,EAAE;gBACJ,IAAI,EAAE,IAAI;aACX;SACF,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IAED,KAAK,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAY;QACjC,OAAO,IAAI,CAAC,yBAAyB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IACzD,CAAC;IAED,MAAM,CAAC,EAAU;QACf,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IACzD,CAAC;CACF,CAAA;AA9JY,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,gBAAU,CAAC,CAAC,CAAA;IAEpC,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,kBAAW,CAAC,CAAC,CAAA;qCAHb,sBAAa;QAEhB,gBAAU;QAET,kBAAW;GAPzB,WAAW,CA8JvB"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"auth.service.spec.d.ts","sourceRoot":"","sources":["../../../src/auth/src/auth.service.spec.ts"],"names":[],"mappings":""}
|
@@ -1,17 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const testing_1 = require("@nestjs/testing");
|
4
|
-
const auth_service_1 = require("./auth.service");
|
5
|
-
describe('AuthService', () => {
|
6
|
-
let service;
|
7
|
-
beforeEach(async () => {
|
8
|
-
const module = await testing_1.Test.createTestingModule({
|
9
|
-
providers: [auth_service_1.AuthService],
|
10
|
-
}).compile();
|
11
|
-
service = module.get(auth_service_1.AuthService);
|
12
|
-
});
|
13
|
-
it('should be defined', () => {
|
14
|
-
expect(service).toBeDefined();
|
15
|
-
});
|
16
|
-
});
|
17
|
-
//# sourceMappingURL=auth.service.spec.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"auth.service.spec.js","sourceRoot":"","sources":["../../../src/auth/src/auth.service.spec.ts"],"names":[],"mappings":";;AAAA,6CAAsD;AACtD,iDAA6C;AAE7C,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,IAAI,OAAoB,CAAC;IAEzB,UAAU,CAAC,KAAK,IAAI,EAAE;QACpB,MAAM,MAAM,GAAkB,MAAM,cAAI,CAAC,mBAAmB,CAAC;YAC3D,SAAS,EAAE,CAAC,0BAAW,CAAC;SACzB,CAAC,CAAC,OAAO,EAAE,CAAC;QAEb,OAAO,GAAG,MAAM,CAAC,GAAG,CAAc,0BAAW,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mBAAmB,EAAE,GAAG,EAAE;QAC3B,MAAM,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;IAChC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"public.decorator.d.ts","sourceRoot":"","sources":["../../../../src/auth/src/decorators/public.decorator.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,aAAa,CAAC;AACxC,eAAO,MAAM,MAAM,wDAAyC,CAAC"}
|
@@ -1,8 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.Public = exports.IS_PUBLIC_KEY = void 0;
|
4
|
-
const common_1 = require("@nestjs/common");
|
5
|
-
exports.IS_PUBLIC_KEY = 'isPublic';
|
6
|
-
const Public = () => (0, common_1.SetMetadata)(exports.IS_PUBLIC_KEY, true);
|
7
|
-
exports.Public = Public;
|
8
|
-
//# sourceMappingURL=public.decorator.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"public.decorator.js","sourceRoot":"","sources":["../../../../src/auth/src/decorators/public.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAA6C;AAEhC,QAAA,aAAa,GAAG,UAAU,CAAC;AACjC,MAAM,MAAM,GAAG,GAAG,EAAE,CAAC,IAAA,oBAAW,EAAC,qBAAa,EAAE,IAAI,CAAC,CAAC;AAAhD,QAAA,MAAM,UAA0C"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"user.decorator.d.ts","sourceRoot":"","sources":["../../../../src/auth/src/decorators/user.decorator.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,IAAI,yLAUhB,CAAC"}
|
@@ -1,12 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.User = void 0;
|
4
|
-
const common_1 = require("@nestjs/common");
|
5
|
-
exports.User = (0, common_1.createParamDecorator)((field = null, ctx) => {
|
6
|
-
const request = ctx.switchToHttp().getRequest();
|
7
|
-
if (!request.auth || !request.auth.user) {
|
8
|
-
throw new common_1.UnauthorizedException(`User is not authenticated`);
|
9
|
-
}
|
10
|
-
return field ? request.auth.user[field] : request.auth.user;
|
11
|
-
});
|
12
|
-
//# sourceMappingURL=user.decorator.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"user.decorator.js","sourceRoot":"","sources":["../../../../src/auth/src/decorators/user.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAA+F;AAElF,QAAA,IAAI,GAAG,IAAA,6BAAoB,EACtC,CAAC,QAAuB,IAAI,EAAE,GAAqB,EAAE,EAAE;IACrD,MAAM,OAAO,GAAG,GAAG,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC;IAEhD,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QACxC,MAAM,IAAI,8BAAqB,CAAC,2BAA2B,CAAC,CAAC;IAC/D,CAAC;IAED,OAAO,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;AAC9D,CAAC,CACF,CAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"forget.dto.d.ts","sourceRoot":"","sources":["../../../../src/auth/src/dto/forget.dto.ts"],"names":[],"mappings":"AAEA,qBAAa,SAAS;IAGpB,KAAK,EAAE,MAAM,CAAC;CAEf"}
|
@@ -1,21 +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.ForgetDTO = void 0;
|
13
|
-
const class_validator_1 = require("class-validator");
|
14
|
-
class ForgetDTO {
|
15
|
-
}
|
16
|
-
exports.ForgetDTO = ForgetDTO;
|
17
|
-
__decorate([
|
18
|
-
(0, class_validator_1.IsEmail)(),
|
19
|
-
__metadata("design:type", String)
|
20
|
-
], ForgetDTO.prototype, "email", void 0);
|
21
|
-
//# sourceMappingURL=forget.dto.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"forget.dto.js","sourceRoot":"","sources":["../../../../src/auth/src/dto/forget.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA0C;AAE1C,MAAa,SAAS;CAKrB;AALD,8BAKC;AAFC;IADC,IAAA,yBAAO,GAAE;;wCACI"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"login.dto.d.ts","sourceRoot":"","sources":["../../../../src/auth/src/dto/login.dto.ts"],"names":[],"mappings":"AAEA,qBAAa,QAAQ;IAEnB,KAAK,EAAE,MAAM,CAAC;IASd,QAAQ,EAAE,MAAM,CAAC;CAClB"}
|
@@ -1,31 +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.LoginDTO = void 0;
|
13
|
-
const class_validator_1 = require("class-validator");
|
14
|
-
class LoginDTO {
|
15
|
-
}
|
16
|
-
exports.LoginDTO = LoginDTO;
|
17
|
-
__decorate([
|
18
|
-
(0, class_validator_1.IsEmail)(),
|
19
|
-
__metadata("design:type", String)
|
20
|
-
], LoginDTO.prototype, "email", void 0);
|
21
|
-
__decorate([
|
22
|
-
(0, class_validator_1.IsStrongPassword)({
|
23
|
-
minLength: 6,
|
24
|
-
minLowercase: 1,
|
25
|
-
minUppercase: 0,
|
26
|
-
minNumbers: 0,
|
27
|
-
minSymbols: 0,
|
28
|
-
}),
|
29
|
-
__metadata("design:type", String)
|
30
|
-
], LoginDTO.prototype, "password", void 0);
|
31
|
-
//# sourceMappingURL=login.dto.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"login.dto.js","sourceRoot":"","sources":["../../../../src/auth/src/dto/login.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA4D;AAE5D,MAAa,QAAQ;CAYpB;AAZD,4BAYC;AAVC;IADC,IAAA,yBAAO,GAAE;;uCACI;AASd;IAPC,IAAA,kCAAgB,EAAC;QAChB,SAAS,EAAE,CAAC;QACZ,YAAY,EAAE,CAAC;QACf,YAAY,EAAE,CAAC;QACf,UAAU,EAAE,CAAC;QACb,UAAU,EAAE,CAAC;KACd,CAAC;;0CACe"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"otp.dto.d.ts","sourceRoot":"","sources":["../../../../src/auth/src/dto/otp.dto.ts"],"names":[],"mappings":"AAEA,qBAAa,MAAM;IAKjB,IAAI,EAAE,MAAM,CAAC;IAGb,KAAK,EAAE,MAAM,CAAC;CAEf"}
|
@@ -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.OtpDTO = void 0;
|
13
|
-
const class_validator_1 = require("class-validator");
|
14
|
-
class OtpDTO {
|
15
|
-
}
|
16
|
-
exports.OtpDTO = OtpDTO;
|
17
|
-
__decorate([
|
18
|
-
(0, class_validator_1.Min)(0),
|
19
|
-
(0, class_validator_1.Max)(999999),
|
20
|
-
(0, class_validator_1.IsInt)(),
|
21
|
-
__metadata("design:type", Number)
|
22
|
-
], OtpDTO.prototype, "code", void 0);
|
23
|
-
__decorate([
|
24
|
-
(0, class_validator_1.IsJWT)(),
|
25
|
-
__metadata("design:type", String)
|
26
|
-
], OtpDTO.prototype, "token", void 0);
|
27
|
-
//# sourceMappingURL=otp.dto.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"otp.dto.js","sourceRoot":"","sources":["../../../../src/auth/src/dto/otp.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAyD;AAEzD,MAAa,MAAM;CAUlB;AAVD,wBAUC;AALC;IAHC,IAAA,qBAAG,EAAC,CAAC,CAAC;IACN,IAAA,qBAAG,EAAC,MAAM,CAAC;IACX,IAAA,uBAAK,GAAE;;oCACK;AAGb;IADC,IAAA,uBAAK,GAAE;;qCACM"}
|
@@ -1 +0,0 @@
|
|
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"}
|
@@ -1,9 +0,0 @@
|
|
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
|
@@ -1 +0,0 @@
|
|
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"}
|
@@ -1,11 +0,0 @@
|
|
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
|
@@ -1 +0,0 @@
|
|
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"}
|
@@ -1,56 +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.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
|
@@ -1 +0,0 @@
|
|
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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