rez_core 1.0.39 → 1.0.40
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/auth/guards/role.guard.js +3 -3
- package/dist/module/listmaster/controller/list-master.controller.d.ts +14 -0
- package/dist/module/listmaster/controller/list-master.controller.js +38 -0
- package/dist/module/listmaster/controller/list-master.controller.js.map +1 -0
- package/dist/module/listmaster/entity/list-master-items.entity.d.ts +11 -0
- package/dist/module/listmaster/entity/list-master-items.entity.js +55 -0
- package/dist/module/listmaster/entity/list-master-items.entity.js.map +1 -0
- package/dist/module/listmaster/entity/list-master.entity.d.ts +12 -0
- package/dist/module/listmaster/entity/list-master.entity.js +59 -0
- package/dist/module/listmaster/entity/list-master.entity.js.map +1 -0
- package/dist/module/listmaster/listmaster.module.d.ts +2 -0
- package/dist/module/listmaster/listmaster.module.js +27 -0
- package/dist/module/listmaster/listmaster.module.js.map +1 -0
- package/dist/module/listmaster/repository/list-master-items.repository.d.ts +10 -0
- package/dist/module/listmaster/repository/list-master-items.repository.js +38 -0
- package/dist/module/listmaster/repository/list-master-items.repository.js.map +1 -0
- package/dist/module/listmaster/repository/list-master.repository.d.ts +7 -0
- package/dist/module/listmaster/repository/list-master.repository.js +34 -0
- package/dist/module/listmaster/repository/list-master.repository.js.map +1 -0
- package/dist/module/listmaster/service/list-master.service.d.ts +18 -0
- package/dist/module/listmaster/service/list-master.service.js +51 -0
- package/dist/module/listmaster/service/list-master.service.js.map +1 -0
- package/dist/module/master/controller/master.controller.d.ts +1 -0
- package/dist/module/master/controller/master.controller.js +18 -0
- package/dist/module/master/controller/master.controller.js.map +1 -1
- package/dist/module/master/service/master.service.d.ts +5 -1
- package/dist/module/master/service/master.service.js +20 -1
- package/dist/module/master/service/master.service.js.map +1 -1
- package/dist/module/meta/entity/entity-master.entity.d.ts +1 -1
- package/dist/module/meta/entity/entity-master.entity.js +1 -1
- package/dist/module/meta/entity/entity-master.entity.js.map +1 -1
- package/dist/module/meta/repository/entity-table.repository.js +3 -1
- package/dist/module/meta/repository/entity-table.repository.js.map +1 -1
- package/dist/module/meta/service/entity-master.service.d.ts +3 -0
- package/dist/module/meta/service/entity-master.service.js +11 -0
- package/dist/module/meta/service/entity-master.service.js.map +1 -1
- package/dist/module/meta/service/entity-service-impl.service.js +1 -1
- package/dist/module/meta/service/entity-service-impl.service.js.map +1 -1
- package/dist/module/module/controller/module-access.controller.d.ts +8 -2
- package/dist/module/module/controller/module-access.controller.js +2 -0
- package/dist/module/module/controller/module-access.controller.js.map +1 -1
- package/dist/module/module/repository/module-access.repository.d.ts +8 -2
- package/dist/module/module/repository/module-access.repository.js +10 -2
- package/dist/module/module/repository/module-access.repository.js.map +1 -1
- package/dist/module/module/service/module-access.service.d.ts +8 -2
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utils/service/file-util.service.d.ts +3 -0
- package/dist/utils/service/file-util.service.js +15 -0
- package/dist/utils/service/file-util.service.js.map +1 -0
- package/package.json +4 -2
- package/src/constant/global.constant.ts +2 -0
- package/src/module/auth/guards/jwt.guard.ts +22 -22
- package/src/module/auth/guards/role.guard.ts +68 -68
- package/src/module/auth/services/auth.service.ts +29 -29
- package/src/module/auth/services/jwt.service.ts +11 -11
- package/src/module/auth/strategies/local.strategy.ts +13 -13
- package/src/module/dev/dev.module.ts +12 -12
- package/src/module/dev/service/dev.service.ts +7 -7
- package/src/module/enterprise/entity/enterprise.entity.ts +37 -37
- package/src/module/enterprise/entity/organization.entity.ts +80 -80
- package/src/module/listmaster/controller/list-master.controller.ts +14 -0
- package/src/module/listmaster/entity/list-master-items.entity.ts +33 -0
- package/src/module/listmaster/entity/list-master.entity.ts +35 -0
- package/src/module/listmaster/listmaster.module.ts +14 -0
- package/src/module/listmaster/repository/list-master-items.repository.ts +21 -0
- package/src/module/listmaster/repository/list-master.repository.ts +15 -0
- package/src/module/listmaster/service/list-master.service.ts +44 -0
- package/src/module/master/controller/master.controller.ts +40 -22
- package/src/module/master/service/master.service.ts +20 -0
- package/src/module/meta/dto/entity-list-data.dto.ts +6 -6
- package/src/module/meta/entity/attribute-master.entity.ts +67 -67
- package/src/module/meta/entity/entity-master.entity.ts +1 -1
- package/src/module/meta/entity/preference.entity.ts +65 -65
- package/src/module/meta/repository/attribute-master.repository.ts +28 -28
- package/src/module/meta/repository/entity-table.repository.ts +3 -1
- package/src/module/meta/repository/preference.repository.ts +20 -20
- package/src/module/meta/service/entity-master.service.ts +14 -0
- package/src/module/meta/service/entity-service-impl.service.ts +1 -1
- package/src/module/module/controller/menu.controller.ts +15 -15
- package/src/module/module/controller/module-access.controller.ts +4 -1
- package/src/module/module/entity/module-access.entity.ts +22 -22
- package/src/module/module/entity/module-action.entity.ts +19 -19
- package/src/module/module/repository/module-access.repository.ts +12 -2
- package/src/module/user/controller/user.controller.ts +28 -28
- package/src/module/user/dto/update-user.dto.ts +4 -4
- package/src/module/user/entity/user-role-mapping.entity.ts +21 -21
- package/src/module/user/entity/user-session.entity.ts +61 -61
- package/src/module/user/entity/user.entity.ts +35 -35
- package/src/module/user/repository/role.repository.ts +16 -16
- package/src/module/user/repository/userSession.repository.ts +33 -33
- package/src/utils/service/encryptUtil.service.ts +97 -97
- package/src/utils/service/excelUtil.service.ts +15 -15
- package/src/utils/service/file-util.service.ts +11 -0
- package/src/utils/service/reflection-helper.service.ts +53 -53
- package/.idea/250218_nodejs_core.iml +0 -12
- package/.idea/codeStyles/Project.xml +0 -59
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/dataSources.xml +0 -12
- package/.idea/modules.xml +0 -8
- package/.idea/prettier.xml +0 -6
- package/.idea/vcs.xml +0 -6
|
@@ -23,4 +23,18 @@ export class EntityMasterService {
|
|
|
23
23
|
|
|
24
24
|
return entityMaster;
|
|
25
25
|
}
|
|
26
|
+
|
|
27
|
+
async save(entityMaster: EntityMaster) {
|
|
28
|
+
return await this.entityMasterRepository.save(entityMaster);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async update(id: number, entityMaster: EntityMaster) {
|
|
32
|
+
return await this.entityMasterRepository.update(id, entityMaster);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async findByMappedEntityType(mappedEntityType: string) {
|
|
36
|
+
return await this.entityMasterRepository.findOne({
|
|
37
|
+
where: { mapped_entity_type: mappedEntityType },
|
|
38
|
+
});
|
|
39
|
+
}
|
|
26
40
|
}
|
|
@@ -261,7 +261,7 @@ export class EntityServiceImpl implements EntityService<BaseEntity> {
|
|
|
261
261
|
} else {
|
|
262
262
|
let entityMaster =
|
|
263
263
|
await this.entityMasterService.getEntityData(entityType);
|
|
264
|
-
tableName = entityMaster.
|
|
264
|
+
tableName = entityMaster.db_table_name;
|
|
265
265
|
}
|
|
266
266
|
return await this.entityListService.getMaxSequenceNumber(
|
|
267
267
|
tableName,
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { Controller, Get, Request, UseGuards } from '@nestjs/common';
|
|
2
|
-
import { MenuService } from '../service/menu.service';
|
|
3
|
-
import { JwtAuthGuard } from 'src/module/auth/guards/jwt.guard';
|
|
4
|
-
|
|
5
|
-
@Controller('menu')
|
|
6
|
-
export class MenuController {
|
|
7
|
-
constructor(private readonly menuService: MenuService) {}
|
|
8
|
-
|
|
9
|
-
@UseGuards(JwtAuthGuard)
|
|
10
|
-
@Get()
|
|
11
|
-
async getMenu(@Request() req) {
|
|
12
|
-
const userId = req.user.userId;
|
|
13
|
-
return this.menuService.getUserMenu(userId);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
1
|
+
import { Controller, Get, Request, UseGuards } from '@nestjs/common';
|
|
2
|
+
import { MenuService } from '../service/menu.service';
|
|
3
|
+
import { JwtAuthGuard } from 'src/module/auth/guards/jwt.guard';
|
|
4
|
+
|
|
5
|
+
@Controller('menu')
|
|
6
|
+
export class MenuController {
|
|
7
|
+
constructor(private readonly menuService: MenuService) {}
|
|
8
|
+
|
|
9
|
+
@UseGuards(JwtAuthGuard)
|
|
10
|
+
@Get()
|
|
11
|
+
async getMenu(@Request() req) {
|
|
12
|
+
const userId = req.user.userId;
|
|
13
|
+
return this.menuService.getUserMenu(userId);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { Body, Controller, Get, Post, Query } from '@nestjs/common';
|
|
1
|
+
import { Body, Controller, Get, Post, Query, UseGuards } from '@nestjs/common';
|
|
2
2
|
import { ModuleAccessService } from '../service/module-access.service';
|
|
3
|
+
import { JwtAuthGuard } from 'src/module/auth/guards/jwt.guard';
|
|
3
4
|
|
|
4
5
|
@Controller('module-access')
|
|
6
|
+
@UseGuards(JwtAuthGuard)
|
|
5
7
|
export class ModuleAccessController {
|
|
6
8
|
constructor(private readonly moduleAccessService: ModuleAccessService) {}
|
|
7
9
|
|
|
10
|
+
|
|
8
11
|
@Get('roles')
|
|
9
12
|
async getRoles() {
|
|
10
13
|
return this.moduleAccessService.getRoles();
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
|
|
2
|
-
|
|
3
|
-
@Entity({ name: 'cr_module_access' })
|
|
4
|
-
export class ModuleAccess {
|
|
5
|
-
@PrimaryGeneratedColumn()
|
|
6
|
-
id: number;
|
|
7
|
-
|
|
8
|
-
@Column({type: 'varchar', length: 100, nullable: true})
|
|
9
|
-
module_code: string;
|
|
10
|
-
|
|
11
|
-
@Column({type: 'varchar', length: 100, nullable: true })
|
|
12
|
-
role_code: string;
|
|
13
|
-
|
|
14
|
-
@Column({type: 'int', nullable: true })
|
|
15
|
-
access_flag: number;
|
|
16
|
-
|
|
17
|
-
@Column({type: 'varchar', length: 100, nullable: true })
|
|
18
|
-
action_type: string;
|
|
19
|
-
|
|
20
|
-
@Column({type: 'varchar', length: 100, nullable: true})
|
|
21
|
-
app_code: string;
|
|
22
|
-
}
|
|
1
|
+
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
|
|
2
|
+
|
|
3
|
+
@Entity({ name: 'cr_module_access' })
|
|
4
|
+
export class ModuleAccess {
|
|
5
|
+
@PrimaryGeneratedColumn()
|
|
6
|
+
id: number;
|
|
7
|
+
|
|
8
|
+
@Column({type: 'varchar', length: 100, nullable: true})
|
|
9
|
+
module_code: string;
|
|
10
|
+
|
|
11
|
+
@Column({type: 'varchar', length: 100, nullable: true })
|
|
12
|
+
role_code: string;
|
|
13
|
+
|
|
14
|
+
@Column({type: 'int', nullable: true })
|
|
15
|
+
access_flag: number;
|
|
16
|
+
|
|
17
|
+
@Column({type: 'varchar', length: 100, nullable: true })
|
|
18
|
+
action_type: string;
|
|
19
|
+
|
|
20
|
+
@Column({type: 'varchar', length: 100, nullable: true})
|
|
21
|
+
app_code: string;
|
|
22
|
+
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
|
|
2
|
-
|
|
3
|
-
@Entity({ name: 'module_action' })
|
|
4
|
-
export class ModuleAction {
|
|
5
|
-
@PrimaryGeneratedColumn()
|
|
6
|
-
id: number;
|
|
7
|
-
|
|
8
|
-
@Column({type: 'int', nullable: true})
|
|
9
|
-
module_id: number;
|
|
10
|
-
|
|
11
|
-
@Column({type: 'varchar', length: 100, nullable: true })
|
|
12
|
-
module_code: string;
|
|
13
|
-
|
|
14
|
-
@Column({type: 'varchar', length: 100, nullable: true })
|
|
15
|
-
action_name:string
|
|
16
|
-
|
|
17
|
-
@Column({type: 'varchar', length: 50, nullable: true })
|
|
18
|
-
action_type: string;
|
|
19
|
-
}
|
|
1
|
+
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
|
|
2
|
+
|
|
3
|
+
@Entity({ name: 'module_action' })
|
|
4
|
+
export class ModuleAction {
|
|
5
|
+
@PrimaryGeneratedColumn()
|
|
6
|
+
id: number;
|
|
7
|
+
|
|
8
|
+
@Column({type: 'int', nullable: true})
|
|
9
|
+
module_id: number;
|
|
10
|
+
|
|
11
|
+
@Column({type: 'varchar', length: 100, nullable: true })
|
|
12
|
+
module_code: string;
|
|
13
|
+
|
|
14
|
+
@Column({type: 'varchar', length: 100, nullable: true })
|
|
15
|
+
action_name:string
|
|
16
|
+
|
|
17
|
+
@Column({type: 'varchar', length: 50, nullable: true })
|
|
18
|
+
action_type: string;
|
|
19
|
+
}
|
|
@@ -20,12 +20,22 @@ export class ModuleAccessRepository {
|
|
|
20
20
|
) {}
|
|
21
21
|
|
|
22
22
|
async getRoles() {
|
|
23
|
-
|
|
23
|
+
const roles = await this.roleRepo.find();
|
|
24
|
+
return roles.map(role => ({
|
|
25
|
+
label: role.name,
|
|
26
|
+
value: role.id,
|
|
27
|
+
}));
|
|
24
28
|
}
|
|
29
|
+
|
|
25
30
|
|
|
26
31
|
async getModules() {
|
|
27
|
-
|
|
32
|
+
const modules = await this.moduleRepo.find({ where: { module_level: 'MAINMOD' } });
|
|
33
|
+
return modules.map(mod => ({
|
|
34
|
+
label: mod.name,
|
|
35
|
+
value: mod.id,
|
|
36
|
+
}));
|
|
28
37
|
}
|
|
38
|
+
|
|
29
39
|
|
|
30
40
|
async getAccessListing(roleIds: number[]) {
|
|
31
41
|
// Fetch roles using role IDs
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Body,
|
|
3
|
-
Controller,
|
|
4
|
-
HttpStatus,
|
|
5
|
-
Inject,
|
|
6
|
-
Post,
|
|
7
|
-
Res,
|
|
8
|
-
ValidationPipe,
|
|
9
|
-
} from '@nestjs/common';
|
|
10
|
-
import { UserService } from '../service/user.service';
|
|
11
|
-
import { CreateUserDto } from '../dto/create-user.dto';
|
|
12
|
-
import { Response } from 'express';
|
|
13
|
-
|
|
14
|
-
@Controller('user')
|
|
15
|
-
export class UserController {
|
|
16
|
-
constructor(
|
|
17
|
-
@Inject('UserService') private readonly userService: UserService,
|
|
18
|
-
) {}
|
|
19
|
-
|
|
20
|
-
@Post('signup')
|
|
21
|
-
async signup(
|
|
22
|
-
@Body(new ValidationPipe()) createUserDto: CreateUserDto,
|
|
23
|
-
@Res() res: Response,
|
|
24
|
-
) {
|
|
25
|
-
const result = await this.userService.createEntity(createUserDto, null);
|
|
26
|
-
res.status(HttpStatus.OK).json(result);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
Body,
|
|
3
|
+
Controller,
|
|
4
|
+
HttpStatus,
|
|
5
|
+
Inject,
|
|
6
|
+
Post,
|
|
7
|
+
Res,
|
|
8
|
+
ValidationPipe,
|
|
9
|
+
} from '@nestjs/common';
|
|
10
|
+
import { UserService } from '../service/user.service';
|
|
11
|
+
import { CreateUserDto } from '../dto/create-user.dto';
|
|
12
|
+
import { Response } from 'express';
|
|
13
|
+
|
|
14
|
+
@Controller('user')
|
|
15
|
+
export class UserController {
|
|
16
|
+
constructor(
|
|
17
|
+
@Inject('UserService') private readonly userService: UserService,
|
|
18
|
+
) {}
|
|
19
|
+
|
|
20
|
+
@Post('signup')
|
|
21
|
+
async signup(
|
|
22
|
+
@Body(new ValidationPipe()) createUserDto: CreateUserDto,
|
|
23
|
+
@Res() res: Response,
|
|
24
|
+
) {
|
|
25
|
+
const result = await this.userService.createEntity(createUserDto, null);
|
|
26
|
+
res.status(HttpStatus.OK).json(result);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PartialType } from '@nestjs/mapped-types';
|
|
2
|
-
import { CreateUserDto } from './create-user.dto';
|
|
3
|
-
|
|
4
|
-
export class UpdateUserDto extends PartialType(CreateUserDto) {}
|
|
1
|
+
import { PartialType } from '@nestjs/mapped-types';
|
|
2
|
+
import { CreateUserDto } from './create-user.dto';
|
|
3
|
+
|
|
4
|
+
export class UpdateUserDto extends PartialType(CreateUserDto) {}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
|
|
2
|
-
|
|
3
|
-
@Entity({ name: 'cr_user_role_mapping' })
|
|
4
|
-
export class UserRoleMapping {
|
|
5
|
-
constructor(user_id: number, role_id: number) {
|
|
6
|
-
this.user_id = user_id;
|
|
7
|
-
this.role_id = role_id;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
@PrimaryGeneratedColumn()
|
|
11
|
-
id: number;
|
|
12
|
-
|
|
13
|
-
@Column({ type: 'bigint', nullable: true })
|
|
14
|
-
user_id: number;
|
|
15
|
-
|
|
16
|
-
@Column({ type: 'bigint', nullable: true })
|
|
17
|
-
role_id: number;
|
|
18
|
-
|
|
19
|
-
@Column({ type: 'int', nullable: true })
|
|
20
|
-
is_default: number;
|
|
21
|
-
}
|
|
1
|
+
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
|
|
2
|
+
|
|
3
|
+
@Entity({ name: 'cr_user_role_mapping' })
|
|
4
|
+
export class UserRoleMapping {
|
|
5
|
+
constructor(user_id: number, role_id: number) {
|
|
6
|
+
this.user_id = user_id;
|
|
7
|
+
this.role_id = role_id;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
@PrimaryGeneratedColumn()
|
|
11
|
+
id: number;
|
|
12
|
+
|
|
13
|
+
@Column({ type: 'bigint', nullable: true })
|
|
14
|
+
user_id: number;
|
|
15
|
+
|
|
16
|
+
@Column({ type: 'bigint', nullable: true })
|
|
17
|
+
role_id: number;
|
|
18
|
+
|
|
19
|
+
@Column({ type: 'int', nullable: true })
|
|
20
|
+
is_default: number;
|
|
21
|
+
}
|
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
|
|
2
|
-
|
|
3
|
-
@Entity({ name: 'cr_user_session' })
|
|
4
|
-
export class UserSession {
|
|
5
|
-
@PrimaryGeneratedColumn()
|
|
6
|
-
id: number;
|
|
7
|
-
|
|
8
|
-
@Column({
|
|
9
|
-
name: 'is_session_loggedout',
|
|
10
|
-
nullable: true,
|
|
11
|
-
type: 'int',
|
|
12
|
-
})
|
|
13
|
-
is_session_loggedout: number;
|
|
14
|
-
|
|
15
|
-
@Column({
|
|
16
|
-
name: 'login_id',
|
|
17
|
-
nullable: true,
|
|
18
|
-
length: 50,
|
|
19
|
-
})
|
|
20
|
-
login_id: string;
|
|
21
|
-
|
|
22
|
-
@Column({
|
|
23
|
-
name: 'login_time',
|
|
24
|
-
nullable: true,
|
|
25
|
-
})
|
|
26
|
-
login_time: Date;
|
|
27
|
-
|
|
28
|
-
@Column({
|
|
29
|
-
name: 'logout_time',
|
|
30
|
-
nullable: true,
|
|
31
|
-
})
|
|
32
|
-
logout_time: Date;
|
|
33
|
-
|
|
34
|
-
@Column({
|
|
35
|
-
name: 'session_key',
|
|
36
|
-
nullable: true,
|
|
37
|
-
length: 100,
|
|
38
|
-
})
|
|
39
|
-
session_key: string;
|
|
40
|
-
|
|
41
|
-
@Column({
|
|
42
|
-
name: 'user_id',
|
|
43
|
-
nullable: true,
|
|
44
|
-
type: 'bigint',
|
|
45
|
-
})
|
|
46
|
-
user_id: number;
|
|
47
|
-
|
|
48
|
-
@Column({
|
|
49
|
-
name: 'access_token',
|
|
50
|
-
nullable: true,
|
|
51
|
-
type: 'varchar',
|
|
52
|
-
length: 5000,
|
|
53
|
-
})
|
|
54
|
-
access_token: string;
|
|
55
|
-
|
|
56
|
-
@Column({
|
|
57
|
-
name: 'expiry_date',
|
|
58
|
-
nullable: true,
|
|
59
|
-
})
|
|
60
|
-
expiry_date: Date;
|
|
61
|
-
}
|
|
1
|
+
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
|
|
2
|
+
|
|
3
|
+
@Entity({ name: 'cr_user_session' })
|
|
4
|
+
export class UserSession {
|
|
5
|
+
@PrimaryGeneratedColumn()
|
|
6
|
+
id: number;
|
|
7
|
+
|
|
8
|
+
@Column({
|
|
9
|
+
name: 'is_session_loggedout',
|
|
10
|
+
nullable: true,
|
|
11
|
+
type: 'int',
|
|
12
|
+
})
|
|
13
|
+
is_session_loggedout: number;
|
|
14
|
+
|
|
15
|
+
@Column({
|
|
16
|
+
name: 'login_id',
|
|
17
|
+
nullable: true,
|
|
18
|
+
length: 50,
|
|
19
|
+
})
|
|
20
|
+
login_id: string;
|
|
21
|
+
|
|
22
|
+
@Column({
|
|
23
|
+
name: 'login_time',
|
|
24
|
+
nullable: true,
|
|
25
|
+
})
|
|
26
|
+
login_time: Date;
|
|
27
|
+
|
|
28
|
+
@Column({
|
|
29
|
+
name: 'logout_time',
|
|
30
|
+
nullable: true,
|
|
31
|
+
})
|
|
32
|
+
logout_time: Date;
|
|
33
|
+
|
|
34
|
+
@Column({
|
|
35
|
+
name: 'session_key',
|
|
36
|
+
nullable: true,
|
|
37
|
+
length: 100,
|
|
38
|
+
})
|
|
39
|
+
session_key: string;
|
|
40
|
+
|
|
41
|
+
@Column({
|
|
42
|
+
name: 'user_id',
|
|
43
|
+
nullable: true,
|
|
44
|
+
type: 'bigint',
|
|
45
|
+
})
|
|
46
|
+
user_id: number;
|
|
47
|
+
|
|
48
|
+
@Column({
|
|
49
|
+
name: 'access_token',
|
|
50
|
+
nullable: true,
|
|
51
|
+
type: 'varchar',
|
|
52
|
+
length: 5000,
|
|
53
|
+
})
|
|
54
|
+
access_token: string;
|
|
55
|
+
|
|
56
|
+
@Column({
|
|
57
|
+
name: 'expiry_date',
|
|
58
|
+
nullable: true,
|
|
59
|
+
})
|
|
60
|
+
expiry_date: Date;
|
|
61
|
+
}
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { Column, Entity } from 'typeorm';
|
|
2
|
-
import { ENTITYTYPE_USER } from '../../../constant/global.constant';
|
|
3
|
-
import { BaseEntity } from '../../meta/entity/base-entity.entity';
|
|
4
|
-
|
|
5
|
-
@Entity({ name: 'cr_user' })
|
|
6
|
-
export class UserData extends BaseEntity {
|
|
7
|
-
constructor() {
|
|
8
|
-
super();
|
|
9
|
-
this.entity_type = ENTITYTYPE_USER;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
@Column({ type: 'varchar', length: 50, nullable: true })
|
|
13
|
-
first_name: string;
|
|
14
|
-
|
|
15
|
-
@Column({ type: 'varchar', length: 50, nullable: true })
|
|
16
|
-
last_name: string;
|
|
17
|
-
|
|
18
|
-
@Column({ type: 'varchar', length: 200, nullable: true })
|
|
19
|
-
password: string;
|
|
20
|
-
|
|
21
|
-
@Column({ type: 'varchar', length: 200, nullable: true })
|
|
22
|
-
email_id: string;
|
|
23
|
-
|
|
24
|
-
@Column({ type: 'varchar', length: 50, nullable: true })
|
|
25
|
-
mobile: string;
|
|
26
|
-
|
|
27
|
-
@Column({ type: 'int', nullable: true })
|
|
28
|
-
is_firstlogin: number;
|
|
29
|
-
|
|
30
|
-
@Column({ type: 'int', width: 1, nullable: true })
|
|
31
|
-
is_defaultadmin: number;
|
|
32
|
-
|
|
33
|
-
@Column({ type: 'int', width: 1, nullable: true })
|
|
34
|
-
is_customer: number;
|
|
35
|
-
}
|
|
1
|
+
import { Column, Entity } from 'typeorm';
|
|
2
|
+
import { ENTITYTYPE_USER } from '../../../constant/global.constant';
|
|
3
|
+
import { BaseEntity } from '../../meta/entity/base-entity.entity';
|
|
4
|
+
|
|
5
|
+
@Entity({ name: 'cr_user' })
|
|
6
|
+
export class UserData extends BaseEntity {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
this.entity_type = ENTITYTYPE_USER;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@Column({ type: 'varchar', length: 50, nullable: true })
|
|
13
|
+
first_name: string;
|
|
14
|
+
|
|
15
|
+
@Column({ type: 'varchar', length: 50, nullable: true })
|
|
16
|
+
last_name: string;
|
|
17
|
+
|
|
18
|
+
@Column({ type: 'varchar', length: 200, nullable: true })
|
|
19
|
+
password: string;
|
|
20
|
+
|
|
21
|
+
@Column({ type: 'varchar', length: 200, nullable: true })
|
|
22
|
+
email_id: string;
|
|
23
|
+
|
|
24
|
+
@Column({ type: 'varchar', length: 50, nullable: true })
|
|
25
|
+
mobile: string;
|
|
26
|
+
|
|
27
|
+
@Column({ type: 'int', nullable: true })
|
|
28
|
+
is_firstlogin: number;
|
|
29
|
+
|
|
30
|
+
@Column({ type: 'int', width: 1, nullable: true })
|
|
31
|
+
is_defaultadmin: number;
|
|
32
|
+
|
|
33
|
+
@Column({ type: 'int', width: 1, nullable: true })
|
|
34
|
+
is_customer: number;
|
|
35
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { Injectable } from '@nestjs/common';
|
|
2
|
-
import { Repository } from 'typeorm';
|
|
3
|
-
import { InjectRepository } from '@nestjs/typeorm';
|
|
4
|
-
import { Role } from '../entity/role.entity';
|
|
5
|
-
|
|
6
|
-
@Injectable()
|
|
7
|
-
export class RoleRepository {
|
|
8
|
-
constructor(
|
|
9
|
-
@InjectRepository(Role)
|
|
10
|
-
private readonly roleRepo: Repository<Role>,
|
|
11
|
-
) {}
|
|
12
|
-
|
|
13
|
-
async findByCode(code: string): Promise<Role | null> {
|
|
14
|
-
return this.roleRepo.findOne({ where: { code } });
|
|
15
|
-
}
|
|
16
|
-
}
|
|
1
|
+
import { Injectable } from '@nestjs/common';
|
|
2
|
+
import { Repository } from 'typeorm';
|
|
3
|
+
import { InjectRepository } from '@nestjs/typeorm';
|
|
4
|
+
import { Role } from '../entity/role.entity';
|
|
5
|
+
|
|
6
|
+
@Injectable()
|
|
7
|
+
export class RoleRepository {
|
|
8
|
+
constructor(
|
|
9
|
+
@InjectRepository(Role)
|
|
10
|
+
private readonly roleRepo: Repository<Role>,
|
|
11
|
+
) {}
|
|
12
|
+
|
|
13
|
+
async findByCode(code: string): Promise<Role | null> {
|
|
14
|
+
return this.roleRepo.findOne({ where: { code } });
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { Repository } from 'typeorm';
|
|
2
|
-
import { UserSession } from '../entity/user-session.entity';
|
|
3
|
-
import { Injectable } from '@nestjs/common';
|
|
4
|
-
import { InjectRepository } from '@nestjs/typeorm';
|
|
5
|
-
|
|
6
|
-
@Injectable()
|
|
7
|
-
export class UserSessionRepository {
|
|
8
|
-
constructor(
|
|
9
|
-
@InjectRepository(UserSession)
|
|
10
|
-
private userSessionRepo: Repository<UserSession>,
|
|
11
|
-
) {}
|
|
12
|
-
|
|
13
|
-
async findBySessionKey(sessionKey: string): Promise<UserSession | null> {
|
|
14
|
-
return this.userSessionRepo.findOne({ where: { session_key: sessionKey } });
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
async findActiveSessionByUserId(userId: number): Promise<UserSession | null> {
|
|
18
|
-
return this.userSessionRepo.findOne({
|
|
19
|
-
where: { user_id: userId, is_session_loggedout: 0 },
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
async saveSession(session: UserSession): Promise<UserSession> {
|
|
24
|
-
return this.userSessionRepo.save(session);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
async logoutSession(sessionKey: string): Promise<void> {
|
|
28
|
-
await this.userSessionRepo.update(
|
|
29
|
-
{ session_key: sessionKey },
|
|
30
|
-
{ is_session_loggedout: 1, logout_time: new Date() },
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
1
|
+
import { Repository } from 'typeorm';
|
|
2
|
+
import { UserSession } from '../entity/user-session.entity';
|
|
3
|
+
import { Injectable } from '@nestjs/common';
|
|
4
|
+
import { InjectRepository } from '@nestjs/typeorm';
|
|
5
|
+
|
|
6
|
+
@Injectable()
|
|
7
|
+
export class UserSessionRepository {
|
|
8
|
+
constructor(
|
|
9
|
+
@InjectRepository(UserSession)
|
|
10
|
+
private userSessionRepo: Repository<UserSession>,
|
|
11
|
+
) {}
|
|
12
|
+
|
|
13
|
+
async findBySessionKey(sessionKey: string): Promise<UserSession | null> {
|
|
14
|
+
return this.userSessionRepo.findOne({ where: { session_key: sessionKey } });
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
async findActiveSessionByUserId(userId: number): Promise<UserSession | null> {
|
|
18
|
+
return this.userSessionRepo.findOne({
|
|
19
|
+
where: { user_id: userId, is_session_loggedout: 0 },
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async saveSession(session: UserSession): Promise<UserSession> {
|
|
24
|
+
return this.userSessionRepo.save(session);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async logoutSession(sessionKey: string): Promise<void> {
|
|
28
|
+
await this.userSessionRepo.update(
|
|
29
|
+
{ session_key: sessionKey },
|
|
30
|
+
{ is_session_loggedout: 1, logout_time: new Date() },
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
}
|