@lenne.tech/nest-server 8.3.1 → 8.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/common/decorators/restricted.decorator.d.ts +12 -5
- package/dist/core/common/decorators/restricted.decorator.js +91 -29
- package/dist/core/common/decorators/restricted.decorator.js.map +1 -1
- package/dist/core/common/enums/process-type.enum.d.ts +4 -0
- package/dist/core/common/enums/process-type.enum.js +9 -0
- package/dist/core/common/enums/process-type.enum.js.map +1 -0
- package/dist/core/common/enums/role.enum.d.ts +1 -2
- package/dist/core/common/enums/role.enum.js +0 -1
- package/dist/core/common/enums/role.enum.js.map +1 -1
- package/dist/core/common/helpers/db.helper.d.ts +4 -4
- package/dist/core/common/helpers/db.helper.js +54 -30
- package/dist/core/common/helpers/db.helper.js.map +1 -1
- package/dist/core/common/helpers/input.helper.d.ts +6 -5
- package/dist/core/common/helpers/input.helper.js +4 -15
- package/dist/core/common/helpers/input.helper.js.map +1 -1
- package/dist/core/common/helpers/service.helper.d.ts +12 -0
- package/dist/core/common/helpers/service.helper.js +42 -3
- package/dist/core/common/helpers/service.helper.js.map +1 -1
- package/dist/core/common/interfaces/prepare-input-options.interface.d.ts +8 -0
- package/dist/core/common/interfaces/prepare-input-options.interface.js +3 -0
- package/dist/core/common/interfaces/prepare-input-options.interface.js.map +1 -0
- package/dist/core/common/interfaces/prepare-output-options.interface.d.ts +7 -0
- package/dist/core/common/interfaces/prepare-output-options.interface.js +3 -0
- package/dist/core/common/interfaces/prepare-output-options.interface.js.map +1 -0
- package/dist/core/common/interfaces/service-options.interface.d.ts +5 -17
- package/dist/core/common/models/core-persistence.model.d.ts +0 -1
- package/dist/core/common/models/core-persistence.model.js +0 -10
- package/dist/core/common/models/core-persistence.model.js.map +1 -1
- package/dist/core/common/services/module.service.d.ts +4 -4
- package/dist/core/common/services/module.service.js +27 -26
- package/dist/core/common/services/module.service.js.map +1 -1
- package/dist/core/common/types/require-only-one.type.d.ts +3 -0
- package/dist/core/common/types/require-only-one.type.js +3 -0
- package/dist/core/common/types/require-only-one.type.js.map +1 -0
- package/dist/core/common/types/required-at-least-one.type.d.ts +3 -0
- package/dist/core/common/types/required-at-least-one.type.js +3 -0
- package/dist/core/common/types/required-at-least-one.type.js.map +1 -0
- package/dist/core/modules/auth/inputs/core-auth-sign-in.input.d.ts +5 -0
- package/dist/core/modules/auth/inputs/core-auth-sign-in.input.js +34 -0
- package/dist/core/modules/auth/inputs/core-auth-sign-in.input.js.map +1 -0
- package/dist/core/modules/auth/inputs/core-auth-sign-up.input.d.ts +5 -0
- package/dist/core/modules/auth/inputs/core-auth-sign-up.input.js +34 -0
- package/dist/core/modules/auth/inputs/core-auth-sign-up.input.js.map +1 -0
- package/dist/core.module.js +0 -5
- package/dist/core.module.js.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/server/modules/auth/auth.model.js +2 -2
- package/dist/server/modules/auth/auth.model.js.map +1 -1
- package/dist/server/modules/auth/auth.module.js +7 -2
- package/dist/server/modules/auth/auth.module.js.map +1 -1
- package/dist/server/modules/auth/auth.resolver.d.ts +8 -3
- package/dist/server/modules/auth/auth.resolver.js +33 -10
- package/dist/server/modules/auth/auth.resolver.js.map +1 -1
- package/dist/server/modules/auth/auth.service.d.ts +15 -0
- package/dist/server/modules/auth/auth.service.js +71 -0
- package/dist/server/modules/auth/auth.service.js.map +1 -0
- package/dist/server/modules/auth/inputs/auth-sign-in.input.d.ts +3 -0
- package/dist/server/modules/auth/inputs/auth-sign-in.input.js +18 -0
- package/dist/server/modules/auth/inputs/auth-sign-in.input.js.map +1 -0
- package/dist/server/modules/auth/inputs/auth-sign-up.input.d.ts +5 -0
- package/dist/server/modules/auth/inputs/auth-sign-up.input.js +34 -0
- package/dist/server/modules/auth/inputs/auth-sign-up.input.js.map +1 -0
- package/dist/server/modules/user/user.model.d.ts +1 -1
- package/dist/server/modules/user/user.model.js +1 -1
- package/dist/server/modules/user/user.model.js.map +1 -1
- package/dist/server/modules/user/user.resolver.js +12 -11
- package/dist/server/modules/user/user.resolver.js.map +1 -1
- package/dist/server/modules/user/user.service.js +1 -5
- package/dist/server/modules/user/user.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/src/core/common/decorators/restricted.decorator.ts +150 -53
- package/src/core/common/enums/process-type.enum.ts +7 -0
- package/src/core/common/enums/role.enum.ts +1 -4
- package/src/core/common/helpers/db.helper.ts +70 -56
- package/src/core/common/helpers/input.helper.ts +24 -15
- package/src/core/common/helpers/service.helper.ts +72 -2
- package/src/core/common/interfaces/prepare-input-options.interface.ts +11 -0
- package/src/core/common/interfaces/prepare-output-options.interface.ts +10 -0
- package/src/core/common/interfaces/service-options.interface.ts +8 -22
- package/src/core/common/models/core-persistence.model.ts +0 -11
- package/src/core/common/services/module.service.ts +32 -31
- package/src/core/common/types/require-only-one.type.ts +6 -0
- package/src/core/common/types/required-at-least-one.type.ts +6 -0
- package/src/core/modules/auth/inputs/core-auth-sign-in.input.ts +18 -0
- package/src/core/modules/auth/inputs/core-auth-sign-up.input.ts +18 -0
- package/src/core.module.ts +1 -19
- package/src/index.ts +5 -0
- package/src/server/modules/auth/auth.model.ts +5 -5
- package/src/server/modules/auth/auth.module.ts +13 -2
- package/src/server/modules/auth/auth.resolver.ts +30 -12
- package/src/server/modules/auth/auth.service.ts +84 -0
- package/src/server/modules/auth/inputs/auth-sign-in.input.ts +10 -0
- package/src/server/modules/auth/inputs/auth-sign-up.input.ts +18 -0
- package/src/server/modules/user/user.model.ts +2 -2
- package/src/server/modules/user/user.resolver.ts +12 -11
- package/src/server/modules/user/user.service.ts +3 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.model.js","sourceRoot":"","sources":["../../../../src/server/modules/auth/auth.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAAoD;AACpD,gFAA2E;AAC3E,mDAA0C;AAM1C,IAAa,IAAI,GAAjB,MAAa,IAAK,SAAQ,+BAAa;IAAvC;;QASE,SAAI,GAAS,SAAS,CAAC;IAczB,CAAC;IALC,IAAI;QACF,KAAK,CAAC,IAAI,EAAE,CAAC;QAEb,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAA;AAdC;IADC,IAAA,eAAK,EAAC,
|
|
1
|
+
{"version":3,"file":"auth.model.js","sourceRoot":"","sources":["../../../../src/server/modules/auth/auth.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAAoD;AACpD,gFAA2E;AAC3E,mDAA0C;AAM1C,IAAa,IAAI,GAAjB,MAAa,IAAK,SAAQ,+BAAa;IAAvC;;QASE,SAAI,GAAS,SAAS,CAAC;IAczB,CAAC;IALC,IAAI;QACF,KAAK,CAAC,IAAI,EAAE,CAAC;QAEb,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAA;AAdC;IADC,IAAA,eAAK,EAAC,GAAG,EAAE,CAAC,iBAAI,EAAE,EAAE,WAAW,EAAE,oBAAoB,EAAE,CAAC;8BACnD,iBAAI;kCAAa;AATZ,IAAI;IADhB,IAAA,oBAAU,EAAC,EAAE,WAAW,EAAE,qBAAqB,EAAE,CAAC;GACtC,IAAI,CAuBhB;AAvBY,oBAAI"}
|
|
@@ -9,16 +9,21 @@ var AuthModule_1;
|
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.AuthModule = void 0;
|
|
11
11
|
const common_1 = require("@nestjs/common");
|
|
12
|
+
const email_service_1 = require("../../../core/common/services/email.service");
|
|
12
13
|
const core_auth_module_1 = require("../../../core/modules/auth/core-auth.module");
|
|
13
14
|
const user_module_1 = require("../user/user.module");
|
|
14
15
|
const user_service_1 = require("../user/user.service");
|
|
15
16
|
const auth_resolver_1 = require("./auth.resolver");
|
|
17
|
+
const auth_service_1 = require("./auth.service");
|
|
16
18
|
let AuthModule = AuthModule_1 = class AuthModule {
|
|
17
19
|
static forRoot(options) {
|
|
18
20
|
return {
|
|
19
21
|
module: AuthModule_1,
|
|
20
|
-
imports: [
|
|
21
|
-
|
|
22
|
+
imports: [
|
|
23
|
+
core_auth_module_1.CoreAuthModule.forRoot(user_module_1.UserModule, user_service_1.UserService, Object.assign(Object.assign({}, options), {})),
|
|
24
|
+
email_service_1.EmailService,
|
|
25
|
+
],
|
|
26
|
+
providers: [auth_resolver_1.AuthResolver, auth_service_1.AuthService],
|
|
22
27
|
exports: [auth_resolver_1.AuthResolver, core_auth_module_1.CoreAuthModule],
|
|
23
28
|
};
|
|
24
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.module.js","sourceRoot":"","sources":["../../../../src/server/modules/auth/auth.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAuD;AAEvD,kFAA6E;AAC7E,qDAAiD;AACjD,uDAAmD;AACnD,mDAA+C;
|
|
1
|
+
{"version":3,"file":"auth.module.js","sourceRoot":"","sources":["../../../../src/server/modules/auth/auth.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAuD;AAEvD,+EAA2E;AAC3E,kFAA6E;AAC7E,qDAAiD;AACjD,uDAAmD;AACnD,mDAA+C;AAC/C,iDAA6C;AAM7C,IAAa,UAAU,kBAAvB,MAAa,UAAU;IAKrB,MAAM,CAAC,OAAO,CAAC,OAAyB;QACtC,OAAO;YACL,MAAM,EAAE,YAAU;YAClB,OAAO,EAAE;gBACP,iCAAc,CAAC,OAAO,CAAC,wBAAU,EAAE,0BAAW,kCACzC,OAAO,GACP,EAGF,EACD;gBACF,4BAAY;aACb;YACD,SAAS,EAAE,CAAC,4BAAY,EAAE,0BAAW,CAAC;YACtC,OAAO,EAAE,CAAC,4BAAY,EAAE,iCAAc,CAAC;SACxC,CAAC;IACJ,CAAC;CACF,CAAA;AAtBY,UAAU;IADtB,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,UAAU,CAsBtB;AAtBY,gCAAU"}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { GraphQLResolveInfo } from 'graphql';
|
|
2
|
-
import { CoreAuthResolver } from '../../../core/modules/auth/core-auth.resolver';
|
|
3
2
|
import { Auth } from './auth.model';
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import { AuthService } from './auth.service';
|
|
4
|
+
import { AuthSignInInput } from './inputs/auth-sign-in.input';
|
|
5
|
+
import { AuthSignUpInput } from './inputs/auth-sign-up.input';
|
|
6
|
+
export declare class AuthResolver {
|
|
7
|
+
private readonly authService;
|
|
8
|
+
constructor(authService: AuthService);
|
|
9
|
+
signIn(info: GraphQLResolveInfo, input: AuthSignInInput): Promise<Auth>;
|
|
10
|
+
signUp(info: GraphQLResolveInfo, input: AuthSignUpInput): Promise<Auth>;
|
|
6
11
|
}
|
|
@@ -14,24 +14,47 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.AuthResolver = void 0;
|
|
16
16
|
const graphql_1 = require("@nestjs/graphql");
|
|
17
|
-
const core_auth_resolver_1 = require("../../../core/modules/auth/core-auth.resolver");
|
|
18
17
|
const auth_model_1 = require("./auth.model");
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
const auth_service_1 = require("./auth.service");
|
|
19
|
+
const auth_sign_in_input_1 = require("./inputs/auth-sign-in.input");
|
|
20
|
+
const auth_sign_up_input_1 = require("./inputs/auth-sign-up.input");
|
|
21
|
+
let AuthResolver = class AuthResolver {
|
|
22
|
+
constructor(authService) {
|
|
23
|
+
this.authService = authService;
|
|
24
|
+
}
|
|
25
|
+
async signIn(info, input) {
|
|
26
|
+
return this.authService.signIn(input, {
|
|
27
|
+
fieldSelection: { info, select: 'signIn' },
|
|
28
|
+
inputType: auth_sign_in_input_1.AuthSignInInput,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
async signUp(info, input) {
|
|
32
|
+
return this.authService.signUp(input, {
|
|
33
|
+
fieldSelection: { info, select: 'signUp' },
|
|
34
|
+
});
|
|
22
35
|
}
|
|
23
36
|
};
|
|
24
37
|
__decorate([
|
|
25
|
-
(0, graphql_1.Query)((
|
|
26
|
-
__param(0, (0, graphql_1.
|
|
27
|
-
__param(1, (0, graphql_1.Args)('
|
|
28
|
-
__param(2, (0, graphql_1.Info)()),
|
|
38
|
+
(0, graphql_1.Query)(() => auth_model_1.Auth, { description: 'Sign in and get JWT token' }),
|
|
39
|
+
__param(0, (0, graphql_1.Info)()),
|
|
40
|
+
__param(1, (0, graphql_1.Args)('input')),
|
|
29
41
|
__metadata("design:type", Function),
|
|
30
|
-
__metadata("design:paramtypes", [
|
|
42
|
+
__metadata("design:paramtypes", [Object, auth_sign_in_input_1.AuthSignInInput]),
|
|
31
43
|
__metadata("design:returntype", Promise)
|
|
32
44
|
], AuthResolver.prototype, "signIn", null);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, graphql_1.Mutation)(() => auth_model_1.Auth, {
|
|
47
|
+
description: 'Sign up user and get JWT token',
|
|
48
|
+
}),
|
|
49
|
+
__param(0, (0, graphql_1.Info)()),
|
|
50
|
+
__param(1, (0, graphql_1.Args)('input')),
|
|
51
|
+
__metadata("design:type", Function),
|
|
52
|
+
__metadata("design:paramtypes", [Object, auth_sign_up_input_1.AuthSignUpInput]),
|
|
53
|
+
__metadata("design:returntype", Promise)
|
|
54
|
+
], AuthResolver.prototype, "signUp", null);
|
|
33
55
|
AuthResolver = __decorate([
|
|
34
|
-
(0, graphql_1.Resolver)((
|
|
56
|
+
(0, graphql_1.Resolver)(() => auth_model_1.Auth),
|
|
57
|
+
__metadata("design:paramtypes", [auth_service_1.AuthService])
|
|
35
58
|
], AuthResolver);
|
|
36
59
|
exports.AuthResolver = AuthResolver;
|
|
37
60
|
//# sourceMappingURL=auth.resolver.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.resolver.js","sourceRoot":"","sources":["../../../../src/server/modules/auth/auth.resolver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"auth.resolver.js","sourceRoot":"","sources":["../../../../src/server/modules/auth/auth.resolver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAAwE;AAExE,6CAAoC;AACpC,iDAA6C;AAC7C,oEAA8D;AAC9D,oEAA8D;AAM9D,IAAa,YAAY,GAAzB,MAAa,YAAY;IAIvB,YAA6B,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;IAAG,CAAC;IAMzD,KAAK,CAAC,MAAM,CAAS,IAAwB,EAAiB,KAAsB;QAClF,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,EAAE;YACpC,cAAc,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE;YAC1C,SAAS,EAAE,oCAAe;SAC3B,CAAC,CAAC;IACL,CAAC;IAQD,KAAK,CAAC,MAAM,CAAS,IAAwB,EAAiB,KAAsB;QAClF,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,EAAE;YACpC,cAAc,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE;SAC3C,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AAlBC;IADC,IAAA,eAAK,EAAC,GAAG,EAAE,CAAC,iBAAI,EAAE,EAAE,WAAW,EAAE,2BAA2B,EAAE,CAAC;IAClD,WAAA,IAAA,cAAI,GAAE,CAAA;IAA4B,WAAA,IAAA,cAAI,EAAC,OAAO,CAAC,CAAA;;6CAAQ,oCAAe;;0CAKnF;AAQD;IAHC,IAAA,kBAAQ,EAAC,GAAG,EAAE,CAAC,iBAAI,EAAE;QACpB,WAAW,EAAE,gCAAgC;KAC9C,CAAC;IACY,WAAA,IAAA,cAAI,GAAE,CAAA;IAA4B,WAAA,IAAA,cAAI,EAAC,OAAO,CAAC,CAAA;;6CAAQ,oCAAe;;0CAInF;AA3BU,YAAY;IADxB,IAAA,kBAAQ,EAAC,GAAG,EAAE,CAAC,iBAAI,CAAC;qCAKuB,0BAAW;GAJ1C,YAAY,CA4BxB;AA5BY,oCAAY"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { JwtService } from '@nestjs/jwt';
|
|
2
|
+
import { ServiceOptions } from '../../../core/common/interfaces/service-options.interface';
|
|
3
|
+
import { EmailService } from '../../../core/common/services/email.service';
|
|
4
|
+
import { UserService } from '../user/user.service';
|
|
5
|
+
import { Auth } from './auth.model';
|
|
6
|
+
import { AuthSignInInput } from './inputs/auth-sign-in.input';
|
|
7
|
+
import { AuthSignUpInput } from './inputs/auth-sign-up.input';
|
|
8
|
+
export declare class AuthService {
|
|
9
|
+
protected readonly jwtService: JwtService;
|
|
10
|
+
protected readonly emailService: EmailService;
|
|
11
|
+
protected readonly userService: UserService;
|
|
12
|
+
constructor(jwtService: JwtService, emailService: EmailService, userService: UserService);
|
|
13
|
+
signIn(input: AuthSignInInput, serviceOptions?: ServiceOptions): Promise<Auth>;
|
|
14
|
+
signUp(input: AuthSignUpInput, serviceOptions?: ServiceOptions): Promise<Auth>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
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.AuthService = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const jwt_1 = require("@nestjs/jwt");
|
|
15
|
+
const bcrypt = require("bcrypt");
|
|
16
|
+
const config_env_1 = require("../../../config.env");
|
|
17
|
+
const service_helper_1 = require("../../../core/common/helpers/service.helper");
|
|
18
|
+
const email_service_1 = require("../../../core/common/services/email.service");
|
|
19
|
+
const user_service_1 = require("../user/user.service");
|
|
20
|
+
const auth_model_1 = require("./auth.model");
|
|
21
|
+
let AuthService = class AuthService {
|
|
22
|
+
constructor(jwtService, emailService, userService) {
|
|
23
|
+
this.jwtService = jwtService;
|
|
24
|
+
this.emailService = emailService;
|
|
25
|
+
this.userService = userService;
|
|
26
|
+
}
|
|
27
|
+
async signIn(input, serviceOptions) {
|
|
28
|
+
const serviceOptionsForUserService = (0, service_helper_1.prepareServiceOptions)(serviceOptions, {
|
|
29
|
+
prepareOutput: null,
|
|
30
|
+
subFieldSelection: 'user',
|
|
31
|
+
});
|
|
32
|
+
const user = await this.userService.getViaEmail(input.email, serviceOptionsForUserService);
|
|
33
|
+
if (!user) {
|
|
34
|
+
throw new common_1.UnauthorizedException();
|
|
35
|
+
}
|
|
36
|
+
if (!(await bcrypt.compare(input.password, user.password))) {
|
|
37
|
+
throw new common_1.UnauthorizedException();
|
|
38
|
+
}
|
|
39
|
+
const payload = { email: user.email };
|
|
40
|
+
return auth_model_1.Auth.map({
|
|
41
|
+
token: this.jwtService.sign(payload),
|
|
42
|
+
user,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
async signUp(input, serviceOptions) {
|
|
46
|
+
const serviceOptionsForUserService = (0, service_helper_1.prepareServiceOptions)(serviceOptions, {
|
|
47
|
+
subFieldSelection: 'user',
|
|
48
|
+
});
|
|
49
|
+
const user = await this.userService.create(input, serviceOptionsForUserService);
|
|
50
|
+
if (!user) {
|
|
51
|
+
throw Error('Email Address already in use');
|
|
52
|
+
}
|
|
53
|
+
await this.emailService.sendMail(user.email, 'Welcome', {
|
|
54
|
+
htmlTemplate: 'welcome',
|
|
55
|
+
templateData: { name: user.username, link: config_env_1.default.email.verificationLink + '/' + user.verificationToken },
|
|
56
|
+
});
|
|
57
|
+
const payload = { email: user.email };
|
|
58
|
+
return auth_model_1.Auth.map({
|
|
59
|
+
token: this.jwtService.sign(payload),
|
|
60
|
+
user: user,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
AuthService = __decorate([
|
|
65
|
+
(0, common_1.Injectable)(),
|
|
66
|
+
__metadata("design:paramtypes", [jwt_1.JwtService,
|
|
67
|
+
email_service_1.EmailService,
|
|
68
|
+
user_service_1.UserService])
|
|
69
|
+
], AuthService);
|
|
70
|
+
exports.AuthService = AuthService;
|
|
71
|
+
//# sourceMappingURL=auth.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.service.js","sourceRoot":"","sources":["../../../../src/server/modules/auth/auth.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAmE;AACnE,qCAAyC;AACzC,iCAAiC;AACjC,oDAA4C;AAC5C,gFAAoF;AAGpF,+EAA2E;AAE3E,uDAAmD;AACnD,6CAAoC;AAKpC,IAAa,WAAW,GAAxB,MAAa,WAAW;IACtB,YACqB,UAAsB,EACtB,YAA0B,EAC1B,WAAwB;QAFxB,eAAU,GAAV,UAAU,CAAY;QACtB,iBAAY,GAAZ,YAAY,CAAc;QAC1B,gBAAW,GAAX,WAAW,CAAa;IAC1C,CAAC;IAKJ,KAAK,CAAC,MAAM,CAAC,KAAsB,EAAE,cAA+B;QAElE,MAAM,4BAA4B,GAAG,IAAA,sCAAqB,EAAC,cAAc,EAAE;YAEzE,aAAa,EAAE,IAAI;YAGnB,iBAAiB,EAAE,MAAM;SAC1B,CAAC,CAAC;QAGH,MAAM,IAAI,GAAG,MAAM,IAAI,CAA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AC,GAAG,CAAC;YACd,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC;YACpC,IAAI,EAAE,IAAI;SACX,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AApEY,WAAW;IADvB,IAAA,mBAAU,GAAE;qCAGsB,gBAAU;QACR,4BAAY;QACb,0BAAW;GAJlC,WAAW,CAoEvB;AApEY,kCAAW"}
|
|
@@ -0,0 +1,18 @@
|
|
|
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.AuthSignInInput = void 0;
|
|
10
|
+
const graphql_1 = require("@nestjs/graphql");
|
|
11
|
+
const core_auth_sign_in_input_1 = require("../../../../core/modules/auth/inputs/core-auth-sign-in.input");
|
|
12
|
+
let AuthSignInInput = class AuthSignInInput extends core_auth_sign_in_input_1.CoreAuthSignInInput {
|
|
13
|
+
};
|
|
14
|
+
AuthSignInInput = __decorate([
|
|
15
|
+
(0, graphql_1.InputType)({ description: 'Description for AuthSignInInput' })
|
|
16
|
+
], AuthSignInInput);
|
|
17
|
+
exports.AuthSignInInput = AuthSignInInput;
|
|
18
|
+
//# sourceMappingURL=auth-sign-in.input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-sign-in.input.js","sourceRoot":"","sources":["../../../../../src/server/modules/auth/inputs/auth-sign-in.input.ts"],"names":[],"mappings":";;;;;;;;;AAAA,6CAA4C;AAC5C,0GAAmG;AAMnG,IAAa,eAAe,GAA5B,MAAa,eAAgB,SAAQ,6CAAmB;CAEvD,CAAA;AAFY,eAAe;IAD3B,IAAA,mBAAS,EAAC,EAAE,WAAW,EAAE,iCAAiC,EAAE,CAAC;GACjD,eAAe,CAE3B;AAFY,0CAAe"}
|
|
@@ -0,0 +1,34 @@
|
|
|
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.AuthSignUpInput = void 0;
|
|
13
|
+
const graphql_1 = require("@nestjs/graphql");
|
|
14
|
+
const core_auth_sign_up_input_1 = require("../../../../core/modules/auth/inputs/core-auth-sign-up.input");
|
|
15
|
+
let AuthSignUpInput = class AuthSignUpInput extends core_auth_sign_up_input_1.CoreAuthSignUpInput {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
this.firstName = undefined;
|
|
19
|
+
this.lastName = undefined;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, graphql_1.Field)({ description: 'firstName', nullable: true }),
|
|
24
|
+
__metadata("design:type", String)
|
|
25
|
+
], AuthSignUpInput.prototype, "firstName", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
(0, graphql_1.Field)({ description: 'lastName', nullable: true }),
|
|
28
|
+
__metadata("design:type", String)
|
|
29
|
+
], AuthSignUpInput.prototype, "lastName", void 0);
|
|
30
|
+
AuthSignUpInput = __decorate([
|
|
31
|
+
(0, graphql_1.InputType)({ description: 'Description for AuthSignUpInput' })
|
|
32
|
+
], AuthSignUpInput);
|
|
33
|
+
exports.AuthSignUpInput = AuthSignUpInput;
|
|
34
|
+
//# sourceMappingURL=auth-sign-up.input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-sign-up.input.js","sourceRoot":"","sources":["../../../../../src/server/modules/auth/inputs/auth-sign-up.input.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAAmD;AACnD,0GAAmG;AAMnG,IAAa,eAAe,GAA5B,MAAa,eAAgB,SAAQ,6CAAmB;IAAxD;;QAME,cAAS,GAAW,SAAS,CAAC;QAG9B,aAAQ,GAAW,SAAS,CAAC;IAC/B,CAAC;CAAA,CAAA;AAJC;IADC,IAAA,eAAK,EAAC,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kDACtB;AAG9B;IADC,IAAA,eAAK,EAAC,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDACtB;AATlB,eAAe;IAD3B,IAAA,mBAAS,EAAC,EAAE,WAAW,EAAE,iCAAiC,EAAE,CAAC;GACjD,eAAe,CAU3B;AAVY,0CAAe"}
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
/// <reference types="mongoose/types/mongooseoptions" />
|
|
7
7
|
/// <reference types="mongoose/types/pipelinestage" />
|
|
8
8
|
/// <reference types="mongoose/types/schemaoptions" />
|
|
9
|
+
import { Document, Schema } from 'mongoose';
|
|
9
10
|
import { CoreUserModel } from '../../../core/modules/user/core-user.model';
|
|
10
11
|
import { PersistenceModel } from '../../common/models/persistence.model';
|
|
11
|
-
import { Schema, Document } from 'mongoose';
|
|
12
12
|
export declare type UserDocument = User & Document;
|
|
13
13
|
export declare class User extends CoreUserModel implements PersistenceModel {
|
|
14
14
|
avatar: string;
|
|
@@ -12,9 +12,9 @@ var User_1;
|
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
exports.UserSchema = exports.User = void 0;
|
|
14
14
|
const graphql_1 = require("@nestjs/graphql");
|
|
15
|
-
const core_user_model_1 = require("../../../core/modules/user/core-user.model");
|
|
16
15
|
const mongoose_1 = require("@nestjs/mongoose");
|
|
17
16
|
const mongoose_2 = require("mongoose");
|
|
17
|
+
const core_user_model_1 = require("../../../core/modules/user/core-user.model");
|
|
18
18
|
let User = User_1 = class User extends core_user_model_1.CoreUserModel {
|
|
19
19
|
constructor() {
|
|
20
20
|
super(...arguments);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.model.js","sourceRoot":"","sources":["../../../../src/server/modules/user/user.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,6CAAoD;AACpD
|
|
1
|
+
{"version":3,"file":"user.model.js","sourceRoot":"","sources":["../../../../src/server/modules/user/user.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,6CAAoD;AACpD,+CAAiF;AACjF,uCAA4C;AAC5C,gFAA2E;AAU3E,IAAa,IAAI,YAAjB,MAAa,IAAK,SAAQ,+BAAa;IAAvC;;QAUE,WAAM,GAAW,SAAS,CAAC;QAY3B,cAAS,GAAS,SAAS,CAAC;QAY5B,cAAS,GAAS,SAAS,CAAC;IAc9B,CAAC;IALC,IAAI;QACF,KAAK,CAAC,IAAI,EAAE,CAAC;QAEb,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAA;AAtCC;IAFC,IAAA,eAAK,EAAC,EAAE,WAAW,EAAE,gCAAgC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACxE,IAAA,eAAI,GAAE;;oCACoB;AAY3B;IALC,IAAA,eAAK,EAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAI,EAAE;QACrB,WAAW,EAAE,uCAAuC;QACpD,QAAQ,EAAE,IAAI;KACf,CAAC;IACD,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,iBAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC;8BACxC,IAAI;uCAAa;AAY5B;IALC,IAAA,eAAK,EAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAI,EAAE;QACrB,WAAW,EAAE,4CAA4C;QACzD,QAAQ,EAAE,IAAI;KACf,CAAC;IACD,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,iBAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC;8BACxC,IAAI;uCAAa;AAlCjB,IAAI;IAFhB,IAAA,oBAAU,EAAC,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC;IACnC,IAAA,iBAAc,EAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;GACxB,IAAI,CAgDhB;AAhDY,oBAAI;AAkDJ,QAAA,UAAU,GAAG,wBAAa,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -82,7 +82,7 @@ let UserResolver = class UserResolver {
|
|
|
82
82
|
};
|
|
83
83
|
__decorate([
|
|
84
84
|
(0, roles_decorator_1.Roles)(role_enum_1.RoleEnum.ADMIN),
|
|
85
|
-
(0, graphql_1.Query)((
|
|
85
|
+
(0, graphql_1.Query)(() => [user_model_1.User], { description: 'Find users (via filter)' }),
|
|
86
86
|
__param(0, (0, graphql_1.Info)()),
|
|
87
87
|
__param(1, (0, graphql_1.Args)()),
|
|
88
88
|
__metadata("design:type", Function),
|
|
@@ -91,7 +91,7 @@ __decorate([
|
|
|
91
91
|
], UserResolver.prototype, "findUsers", null);
|
|
92
92
|
__decorate([
|
|
93
93
|
(0, roles_decorator_1.Roles)(role_enum_1.RoleEnum.S_USER),
|
|
94
|
-
(0, graphql_1.Query)((
|
|
94
|
+
(0, graphql_1.Query)(() => user_model_1.User, { description: 'Get user with specified ID' }),
|
|
95
95
|
__param(0, (0, graphql_1.Args)('id')),
|
|
96
96
|
__param(1, (0, graphql_1.Info)()),
|
|
97
97
|
__param(2, (0, graphql_user_decorator_1.GraphQLUser)()),
|
|
@@ -100,21 +100,22 @@ __decorate([
|
|
|
100
100
|
__metadata("design:returntype", Promise)
|
|
101
101
|
], UserResolver.prototype, "getUser", null);
|
|
102
102
|
__decorate([
|
|
103
|
-
(0, graphql_1.Query)((
|
|
103
|
+
(0, graphql_1.Query)(() => Boolean, { description: 'Get verified state of user with token' }),
|
|
104
104
|
__param(0, (0, graphql_1.Args)('token')),
|
|
105
105
|
__metadata("design:type", Function),
|
|
106
106
|
__metadata("design:paramtypes", [String]),
|
|
107
107
|
__metadata("design:returntype", Promise)
|
|
108
108
|
], UserResolver.prototype, "getVerifiedState", null);
|
|
109
109
|
__decorate([
|
|
110
|
-
(0, graphql_1.Query)((
|
|
110
|
+
(0, graphql_1.Query)(() => Boolean, { description: 'Request new password for user with email' }),
|
|
111
111
|
__param(0, (0, graphql_1.Args)('email')),
|
|
112
112
|
__metadata("design:type", Function),
|
|
113
113
|
__metadata("design:paramtypes", [String]),
|
|
114
114
|
__metadata("design:returntype", Promise)
|
|
115
115
|
], UserResolver.prototype, "requestPasswordResetMail", null);
|
|
116
116
|
__decorate([
|
|
117
|
-
(0,
|
|
117
|
+
(0, roles_decorator_1.Roles)(role_enum_1.RoleEnum.ADMIN),
|
|
118
|
+
(0, graphql_1.Mutation)(() => user_model_1.User, { description: 'Create a new user' }),
|
|
118
119
|
__param(0, (0, graphql_1.Args)('input')),
|
|
119
120
|
__param(1, (0, graphql_user_decorator_1.GraphQLUser)()),
|
|
120
121
|
__param(2, (0, graphql_1.Info)()),
|
|
@@ -125,7 +126,7 @@ __decorate([
|
|
|
125
126
|
], UserResolver.prototype, "createUser", null);
|
|
126
127
|
__decorate([
|
|
127
128
|
(0, roles_decorator_1.Roles)(role_enum_1.RoleEnum.S_USER),
|
|
128
|
-
(0, graphql_1.Mutation)((
|
|
129
|
+
(0, graphql_1.Mutation)(() => user_model_1.User, { description: 'Delete existing user' }),
|
|
129
130
|
__param(0, (0, graphql_1.Args)('id')),
|
|
130
131
|
__param(1, (0, graphql_1.Info)()),
|
|
131
132
|
__param(2, (0, graphql_user_decorator_1.GraphQLUser)()),
|
|
@@ -134,7 +135,7 @@ __decorate([
|
|
|
134
135
|
__metadata("design:returntype", Promise)
|
|
135
136
|
], UserResolver.prototype, "deleteUser", null);
|
|
136
137
|
__decorate([
|
|
137
|
-
(0, graphql_1.Mutation)((
|
|
138
|
+
(0, graphql_1.Mutation)(() => Boolean, { description: 'Set new password for user with token' }),
|
|
138
139
|
__param(0, (0, graphql_1.Args)('token')),
|
|
139
140
|
__param(1, (0, graphql_1.Args)('password')),
|
|
140
141
|
__metadata("design:type", Function),
|
|
@@ -143,7 +144,7 @@ __decorate([
|
|
|
143
144
|
], UserResolver.prototype, "resetPassword", null);
|
|
144
145
|
__decorate([
|
|
145
146
|
(0, roles_decorator_1.Roles)(role_enum_1.RoleEnum.S_USER),
|
|
146
|
-
(0, graphql_1.Mutation)((
|
|
147
|
+
(0, graphql_1.Mutation)(() => user_model_1.User, { description: 'Update existing user' }),
|
|
147
148
|
__param(0, (0, graphql_1.Args)('input')),
|
|
148
149
|
__param(1, (0, graphql_1.Args)('id')),
|
|
149
150
|
__param(2, (0, graphql_user_decorator_1.GraphQLUser)()),
|
|
@@ -153,14 +154,14 @@ __decorate([
|
|
|
153
154
|
__metadata("design:returntype", Promise)
|
|
154
155
|
], UserResolver.prototype, "updateUser", null);
|
|
155
156
|
__decorate([
|
|
156
|
-
(0, graphql_1.Mutation)((
|
|
157
|
+
(0, graphql_1.Mutation)(() => Boolean, { description: 'Verify user with email' }),
|
|
157
158
|
__param(0, (0, graphql_1.Args)('token')),
|
|
158
159
|
__metadata("design:type", Function),
|
|
159
160
|
__metadata("design:paramtypes", [String]),
|
|
160
161
|
__metadata("design:returntype", Promise)
|
|
161
162
|
], UserResolver.prototype, "verifyUser", null);
|
|
162
163
|
__decorate([
|
|
163
|
-
(0, graphql_1.Subscription)((
|
|
164
|
+
(0, graphql_1.Subscription)(() => user_model_1.User, {
|
|
164
165
|
filter(payload, variables, context) {
|
|
165
166
|
return context.user.roles.include(role_enum_1.RoleEnum.ADMIN);
|
|
166
167
|
},
|
|
@@ -171,7 +172,7 @@ __decorate([
|
|
|
171
172
|
__metadata("design:returntype", Promise)
|
|
172
173
|
], UserResolver.prototype, "userCreated", null);
|
|
173
174
|
UserResolver = __decorate([
|
|
174
|
-
(0, graphql_1.Resolver)((
|
|
175
|
+
(0, graphql_1.Resolver)(() => user_model_1.User),
|
|
175
176
|
__param(1, (0, common_1.Inject)('PUB_SUB')),
|
|
176
177
|
__metadata("design:paramtypes", [user_service_1.UserService, graphql_subscriptions_1.PubSub])
|
|
177
178
|
], UserResolver);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.resolver.js","sourceRoot":"","sources":["../../../../src/server/modules/user/user.resolver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAwC;AACxC,6CAAsF;AAEtF,iEAA+C;AAC/C,uEAAmE;AACnE,mGAAqF;AACrF,qFAAwE;AACxE,oEAAgE;AAChE,kEAA6D;AAC7D,oDAAgD;AAChD,6CAAoC;AACpC,iDAA6C;AAM7C,IAAa,YAAY,GAAzB,MAAa,YAAY;IAIvB,YAA+B,WAAwB,EAAwC,MAAc;QAA9E,gBAAW,GAAX,WAAW,CAAa;QAAwC,WAAM,GAAN,MAAM,CAAQ;IAAG,CAAC;IAWjH,KAAK,CAAC,SAAS,CAAS,IAAwB,EAAU,IAAiB;QACzE,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE;Y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AW,EAAE,sCAAsC,EAAE,CAAC;IAC5D,WAAA,IAAA,cAAI,EAAC,OAAO,CAAC,CAAA;IAAiB,WAAA,IAAA,cAAI,EAAC,UAAU,CAAC,CAAA;;;;iDAElE;AAOD;IAFC,IAAA,uBAAK,EAAC,oBAAQ,CAAC,MAAM,CAAC;IACtB,IAAA,kBAAQ,EAAC,GAAG,EAAE,CAAC,iBAAI,EAAE,EAAE,WAAW,EAAE,sBAAsB,EAAE,CAAC;IAE3D,WAAA,IAAA,cAAI,EAAC,OAAO,CAAC,CAAA;IACb,WAAA,IAAA,cAAI,EAAC,IAAI,CAAC,CAAA;IACV,WAAA,IAAA,oCAAW,GAAE,CAAA;IACb,WAAA,IAAA,cAAI,GAAE,CAAA;;qCAHe,sBAAS,UAEV,iBAAI;;8CAU1B;AAMD;IADC,IAAA,kBAAQ,EAAC,GAAG,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,wBAAwB,EAAE,CAAC;IACjD,WAAA,IAAA,cAAI,EAAC,OAAO,CAAC,CAAA;;;;8CAE9B;AAeD;IANC,IAAA,sBAAY,EAAC,GAAG,EAAE,CAAC,iBAAI,EAAE;QACxB,MAAM,CAAqB,OAAO,EAAE,SAAS,EAAE,OAAO;YACpD,OAAO,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,oBAAQ,CAAC,KAAK,CAAC,CAAC;QACpD,CAAC;QACD,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI;KACxB,CAAC;;;;+CAGD;AAxIU,YAAY;IADxB,IAAA,kBAAQ,EAAC,GAAG,EAAE,CAAC,iBAAI,CAAC;IAKuC,WAAA,IAAA,eAAM,EAAC,SAAS,CAAC,CAAA;qCAA/B,0BAAW,EAAgD,8BAAM;GAJlG,YAAY,CAyIxB;AAzIY,oCAAY"}
|
|
@@ -36,15 +36,11 @@ let UserService = class UserService extends core_user_service_1.CoreUserService
|
|
|
36
36
|
let user = await super.create(input, serviceOptions);
|
|
37
37
|
if (!user.createdBy) {
|
|
38
38
|
await this.mainDbModel.findByIdAndUpdate(user.id, { createdBy: user.id });
|
|
39
|
-
user = await this.get(user.id, serviceOptions);
|
|
39
|
+
user = await this.get(user.id, Object.assign(Object.assign({}, serviceOptions), { currentUser: serviceOptions.currentUser || user }));
|
|
40
40
|
}
|
|
41
41
|
if ((serviceOptions === null || serviceOptions === void 0 ? void 0 : serviceOptions.pubSub) === undefined || serviceOptions.pubSub) {
|
|
42
42
|
await this.pubSub.publish('userCreated', user_model_1.User.map(user));
|
|
43
43
|
}
|
|
44
|
-
await this.emailService.sendMail(user.email, 'Welcome', {
|
|
45
|
-
htmlTemplate: 'welcome',
|
|
46
|
-
templateData: { name: user.username, link: config_env_1.default.email.verificationLink + '/' + user.verificationToken },
|
|
47
|
-
});
|
|
48
44
|
return user;
|
|
49
45
|
}
|
|
50
46
|
async sendPasswordResetMail(email, serviceOptions) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.service.js","sourceRoot":"","sources":["../../../../src/server/modules/user/user.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAyG;AACzG,+CAA+C;AAC/C,yBAAyB;AACzB,iEAA+C;AAC/C,uCAAiC;AACjC,oDAA4C;AAE5C,iFAA6E;AAC7E,+EAA2E;AAE3E,oFAA+E;AAG/E,6CAAkD;AAMlD,IAAa,WAAW,GAAxB,MAAa,WAAY,SAAQ,mCAAiD;IAQhF,YACqB,aAA4B,EAC5B,YAA0B,EACJ,oBAAgD,EACjD,WAAgC,EAClC,MAAc;QAEpD,KAAK,CAAC,YAAY,EAAE,WAAW,EAAE,oBAAoB,CAAC,CAAC;QANpC,kBAAa,GAAb,aAAa,CAAe;QAC5B,iBAAY,GAAZ,YAAY,CAAc;QACJ,yBAAoB,GAApB,oBAAoB,CAA4B;QACjD,gBAAW,GAAX,WAAW,CAAqB;QAClC,WAAM,GAAN,MAAM,CAAQ;IAGtD,CAAC;IASD,KAAK,C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