rez_core 2.1.121 → 2.1.123
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/constant/global.constant.d.ts +2 -0
- package/dist/constant/global.constant.js +3 -1
- package/dist/constant/global.constant.js.map +1 -1
- package/dist/module/master/controller/master.controller.js +2 -0
- package/dist/module/master/controller/master.controller.js.map +1 -1
- package/dist/module/resolver/resolver.module.js +2 -1
- package/dist/module/resolver/resolver.module.js.map +1 -1
- package/dist/module/user/service/login.service.d.ts +3 -3
- package/dist/module/user/service/login.service.js +10 -9
- package/dist/module/user/service/login.service.js.map +1 -1
- package/dist/module/user/service/user.service.js +2 -1
- package/dist/module/user/service/user.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/constant/global.constant.ts +4 -0
- package/src/module/master/controller/master.controller.ts +1 -1
- package/src/module/resolver/resolver.module.ts +2 -1
- package/src/module/user/service/login.service.ts +18 -9
- package/src/module/user/service/user.service.ts +8 -1
package/package.json
CHANGED
|
@@ -26,6 +26,10 @@ export const STATUS_ACTIVE = 'STATUS_ACTIVE';
|
|
|
26
26
|
export const STATUS_INACTIVE = 'STATUS_INACTIVE';
|
|
27
27
|
export const STATUS_PENDING = 'PENDING';
|
|
28
28
|
|
|
29
|
+
// Invitation Status
|
|
30
|
+
export const INVITATION_STATUS_SENT = 'SENT';
|
|
31
|
+
export const INVITATION_STATUS_ACCEPTED = 'ACCEPTED';
|
|
32
|
+
|
|
29
33
|
// Entity Status
|
|
30
34
|
export const ENTITYSTATUS_TO_BE_PUBLISHED = 'to_be_published';
|
|
31
35
|
export const ENTITYSTATUS_PUBLISHED = 'published';
|
|
@@ -19,7 +19,7 @@ import { EntityServiceImpl } from 'src/module/meta/service/entity-service-impl.s
|
|
|
19
19
|
import { JwtAuthGuard } from 'src/module/auth/guards/jwt.guard';
|
|
20
20
|
|
|
21
21
|
@Controller('master')
|
|
22
|
-
|
|
22
|
+
@UseGuards(JwtAuthGuard)
|
|
23
23
|
export class MasterController {
|
|
24
24
|
constructor(
|
|
25
25
|
private readonly masterService: MasterService,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Module } from '@nestjs/common';
|
|
2
2
|
import { ResolverService } from './service/resolver.service';
|
|
3
|
+
import { ResolverController } from './controller/resolver.controller';
|
|
3
4
|
|
|
4
5
|
@Module({
|
|
5
6
|
imports: [],
|
|
6
|
-
controllers: [],
|
|
7
|
+
controllers: [ResolverController],
|
|
7
8
|
providers: [ResolverService],
|
|
8
9
|
exports: [ResolverService],
|
|
9
10
|
})
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { BadRequestException, Inject, Injectable } from '@nestjs/common';
|
|
2
|
+
import { ConfigService } from '@nestjs/config';
|
|
3
|
+
import { InjectRepository } from '@nestjs/typeorm';
|
|
4
|
+
import {
|
|
5
|
+
INVITATION_STATUS_ACCEPTED,
|
|
6
|
+
STATUS_ACTIVE,
|
|
7
|
+
} from 'src/constant/global.constant';
|
|
2
8
|
import { OrganizationRepository } from 'src/module/enterprise/repository/organization.repository';
|
|
9
|
+
import { ListMasterService } from 'src/module/listmaster/service/list-master.service';
|
|
10
|
+
import { DataSource, Repository } from 'typeorm';
|
|
3
11
|
import { EncryptUtilService } from '../../../utils/service/encryptUtil.service';
|
|
4
12
|
import { Role } from '../entity/role.entity';
|
|
5
13
|
import { UserRoleMapping } from '../entity/user-role-mapping.entity';
|
|
6
14
|
import { UserData } from '../entity/user.entity';
|
|
7
15
|
import { UserSessionService } from './user-session.service';
|
|
8
16
|
import { UserService } from './user.service';
|
|
9
|
-
import { ConfigService } from '@nestjs/config';
|
|
10
|
-
import { InjectRepository } from '@nestjs/typeorm';
|
|
11
|
-
import { DataSource, Repository } from 'typeorm';
|
|
12
|
-
import { ListMasterService } from 'src/module/listmaster/service/list-master.service';
|
|
13
|
-
import { STATUS_ACTIVE } from 'src/constant/global.constant';
|
|
14
17
|
|
|
15
18
|
@Injectable()
|
|
16
19
|
export class LoginService {
|
|
@@ -34,7 +37,7 @@ export class LoginService {
|
|
|
34
37
|
async login(email: string, password: string) {
|
|
35
38
|
const user = await this.userService.findByEmailId(email);
|
|
36
39
|
|
|
37
|
-
console.log(user,
|
|
40
|
+
console.log(user, ' user data');
|
|
38
41
|
if (!user) {
|
|
39
42
|
return {
|
|
40
43
|
success: false,
|
|
@@ -46,14 +49,14 @@ export class LoginService {
|
|
|
46
49
|
user.organization_id,
|
|
47
50
|
);
|
|
48
51
|
|
|
49
|
-
console.log(userOrgData
|
|
52
|
+
console.log(userOrgData, ' user org data');
|
|
50
53
|
|
|
51
54
|
const resolveStatus = await this.listMasterService.getResolvedListCode(
|
|
52
55
|
STATUS_ACTIVE,
|
|
53
56
|
user?.organization_id || 0,
|
|
54
57
|
);
|
|
55
58
|
|
|
56
|
-
console.log(resolveStatus,
|
|
59
|
+
console.log(resolveStatus, ' resolve status');
|
|
57
60
|
|
|
58
61
|
if (
|
|
59
62
|
user.status != resolveStatus.id ||
|
|
@@ -110,8 +113,14 @@ export class LoginService {
|
|
|
110
113
|
defaultAccess,
|
|
111
114
|
);
|
|
112
115
|
|
|
116
|
+
const resolvedInvitationStatus =
|
|
117
|
+
await this.listMasterService.getResolvedListCode(
|
|
118
|
+
INVITATION_STATUS_ACCEPTED,
|
|
119
|
+
user?.organization_id || 0,
|
|
120
|
+
);
|
|
121
|
+
|
|
113
122
|
if (user.is_firstlogin === 1) {
|
|
114
|
-
user.invitation_status =
|
|
123
|
+
user.invitation_status = resolvedInvitationStatus.id;
|
|
115
124
|
user.is_firstlogin = 0;
|
|
116
125
|
const { password, ...userWithoutPassword } = user;
|
|
117
126
|
await this.userService.updateEntity(userWithoutPassword, user);
|
|
@@ -9,6 +9,7 @@ import { ClockIDGenService } from '../../../utils/service/clockIDGenUtil.service
|
|
|
9
9
|
import {
|
|
10
10
|
ENTITYTYPE_ROLE,
|
|
11
11
|
STATUS_ACTIVE,
|
|
12
|
+
INVITATION_STATUS_SENT,
|
|
12
13
|
} from '../../../constant/global.constant';
|
|
13
14
|
import { CreateUserDto } from '../dto/create-user.dto';
|
|
14
15
|
import { UserRoleMappingService } from './user-role-mapping.service';
|
|
@@ -66,6 +67,12 @@ export class UserService extends EntityServiceImpl {
|
|
|
66
67
|
loggedInUser?.organization_id || 0,
|
|
67
68
|
);
|
|
68
69
|
|
|
70
|
+
const resolvedInvitationStatus =
|
|
71
|
+
await this.listMasterService.getResolvedListCode(
|
|
72
|
+
INVITATION_STATUS_SENT,
|
|
73
|
+
loggedInUser?.organization_id || 0,
|
|
74
|
+
);
|
|
75
|
+
|
|
69
76
|
userData.name = (userData.first_name || '') + (userData.last_name || '');
|
|
70
77
|
userData.password = EncryptUtilService.encryptGCM(
|
|
71
78
|
userData.password || 'Admin@123',
|
|
@@ -74,7 +81,7 @@ export class UserService extends EntityServiceImpl {
|
|
|
74
81
|
);
|
|
75
82
|
userData.is_firstlogin = 1;
|
|
76
83
|
userData.roles = [];
|
|
77
|
-
userData.invitation_status =
|
|
84
|
+
userData.invitation_status = resolvedInvitationStatus.id;
|
|
78
85
|
userData.status = resolveStatus.id || 'ACTIVE';
|
|
79
86
|
|
|
80
87
|
const savedData = await super.createEntity(userData, loggedInUser);
|