rez_core 1.0.38 → 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/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/controller/media.controller.js +0 -2
- package/dist/module/meta/controller/media.controller.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/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 +18 -0
- package/src/module/master/service/master.service.ts +20 -0
- package/src/module/meta/controller/media.controller.ts +1 -1
- package/src/module/meta/entity/entity-master.entity.ts +1 -1
- package/src/module/meta/repository/entity-table.repository.ts +3 -1
- 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/module-access.controller.ts +4 -1
- package/src/module/module/repository/module-access.repository.ts +12 -2
- package/src/utils/service/file-util.service.ts +11 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FileUtil = void 0;
|
|
4
|
+
const fs = require("node:fs");
|
|
5
|
+
class FileUtil {
|
|
6
|
+
static deleteFile(path) {
|
|
7
|
+
fs.unlink(path, (err) => {
|
|
8
|
+
if (err) {
|
|
9
|
+
console.log(`Error deleting file ${path}:`, err);
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.FileUtil = FileUtil;
|
|
15
|
+
//# sourceMappingURL=file-util.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-util.service.js","sourceRoot":"","sources":["../../../src/utils/service/file-util.service.ts"],"names":[],"mappings":";;;AAAA,8BAA8B;AAE9B,MAAa,QAAQ;IACnB,MAAM,CAAC,UAAU,CAAC,IAAY;QAC5B,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE;YACtB,IAAI,GAAG,EAAE,CAAC;gBACR,OAAO,CAAC,GAAG,CAAC,uBAAuB,IAAI,GAAG,EAAE,GAAG,CAAC,CAAC;YACnD,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AARD,4BAQC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rez_core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.40",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "",
|
|
6
6
|
"private": false,
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@nestjs/core": "^11.0.1",
|
|
27
27
|
"@nestjs/jwt": "^11.0.0",
|
|
28
28
|
"@nestjs/passport": "^11.0.5",
|
|
29
|
-
"@nestjs/platform-express": "^11.0.
|
|
29
|
+
"@nestjs/platform-express": "^11.0.20",
|
|
30
30
|
"@nestjs/swagger": "^11.0.3",
|
|
31
31
|
"@nestjs/typeorm": "^11.0.0",
|
|
32
32
|
"250218_nodejs_core": "file:",
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"dotenv": "^16.4.7",
|
|
40
40
|
"exceljs": "^4.4.0",
|
|
41
41
|
"moment": "^2.30.1",
|
|
42
|
+
"multer": "^1.4.5-lts.2",
|
|
42
43
|
"mysql2": "^3.12.0",
|
|
43
44
|
"passport": "^0.7.0",
|
|
44
45
|
"passport-google-oauth20": "^2.0.0",
|
|
@@ -61,6 +62,7 @@
|
|
|
61
62
|
"@swc/core": "^1.10.7",
|
|
62
63
|
"@types/express": "^5.0.0",
|
|
63
64
|
"@types/jest": "^29.5.14",
|
|
65
|
+
"@types/multer": "^1.4.12",
|
|
64
66
|
"@types/node": "^22.10.7",
|
|
65
67
|
"@types/supertest": "^6.0.2",
|
|
66
68
|
"eslint": "^9.18.0",
|
|
@@ -7,6 +7,8 @@ export const ENTITYTYPE_ENTITYTABLECOLUMN = 'ETC';
|
|
|
7
7
|
export const ENTITYTYPE_PREFERENCEMASTER = 'PRM';
|
|
8
8
|
export const ENTITYTYPE_VIEWMASTER = 'VMS';
|
|
9
9
|
export const ENTITYTYPE_MEDIA = 'MDA';
|
|
10
|
+
export const ENTITYTYPE_LISTMASTER = 'LMS';
|
|
11
|
+
export const ENTITYTYPE_LISTMASTERITEMS = 'LMI';
|
|
10
12
|
|
|
11
13
|
export const STORAGETYPE_SINGLEJSON = 'singlejson';
|
|
12
14
|
export const STORAGETYPE_COLUMN = 'column';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Controller, Get, Param } from "@nestjs/common";
|
|
2
|
+
import { ListMasterService } from "../service/list-master.service";
|
|
3
|
+
|
|
4
|
+
@Controller("list-master")
|
|
5
|
+
export class ListMasterController {
|
|
6
|
+
|
|
7
|
+
constructor(private readonly service: ListMasterService) {}
|
|
8
|
+
|
|
9
|
+
@Get(':type')
|
|
10
|
+
getDropdownData(@Param('type') type: string) {
|
|
11
|
+
return this.service.getDropdownOptions(type);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
|
|
2
|
+
import { BaseEntity } from '../../meta/entity/base-entity.entity';
|
|
3
|
+
import { ENTITYTYPE_LISTMASTERITEMS } from '../../../constant/global.constant';
|
|
4
|
+
|
|
5
|
+
@Entity({name: 'cr_list_master_items'})
|
|
6
|
+
export class ListMasterItems extends BaseEntity{
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
this.entity_type = ENTITYTYPE_LISTMASTERITEMS;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@PrimaryGeneratedColumn()
|
|
13
|
+
id: number;
|
|
14
|
+
|
|
15
|
+
@Column()
|
|
16
|
+
listtype: string;
|
|
17
|
+
|
|
18
|
+
@Column()
|
|
19
|
+
name: string;
|
|
20
|
+
|
|
21
|
+
@Column()
|
|
22
|
+
status: string;
|
|
23
|
+
|
|
24
|
+
@Column({ default: 0 })
|
|
25
|
+
isdefault: number;
|
|
26
|
+
|
|
27
|
+
@Column({ nullable: true })
|
|
28
|
+
description: string;
|
|
29
|
+
|
|
30
|
+
@Column({ default: 0 })
|
|
31
|
+
sortindex: number;
|
|
32
|
+
|
|
33
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
|
|
2
|
+
import { BaseEntity } from '../../meta/entity/base-entity.entity';
|
|
3
|
+
import { ENTITYTYPE_LISTMASTER } from '../../../constant/global.constant';
|
|
4
|
+
|
|
5
|
+
@Entity({ name: 'cr_list_master' })
|
|
6
|
+
export class ListMasterData extends BaseEntity {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
this.entity_type = ENTITYTYPE_LISTMASTER;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@PrimaryGeneratedColumn()
|
|
13
|
+
id: number;
|
|
14
|
+
|
|
15
|
+
@Column()
|
|
16
|
+
type: string;
|
|
17
|
+
|
|
18
|
+
@Column()
|
|
19
|
+
name: string;
|
|
20
|
+
|
|
21
|
+
@Column()
|
|
22
|
+
status: string;
|
|
23
|
+
|
|
24
|
+
@Column()
|
|
25
|
+
sortby: string;
|
|
26
|
+
|
|
27
|
+
@Column()
|
|
28
|
+
isfactory: number;
|
|
29
|
+
|
|
30
|
+
@Column()
|
|
31
|
+
source: string;
|
|
32
|
+
|
|
33
|
+
@Column({ nullable: true })
|
|
34
|
+
sourcelist: string;
|
|
35
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Module } from '@nestjs/common';
|
|
2
|
+
import { TypeOrmModule } from '@nestjs/typeorm';
|
|
3
|
+
import { ListMasterData } from './entity/list-master.entity';
|
|
4
|
+
import { ListMasterItems } from './entity/list-master-items.entity';
|
|
5
|
+
import { ListMasterRepository } from './repository/list-master.repository';
|
|
6
|
+
import { ListMasterItemsRepository } from './repository/list-master-items.repository';
|
|
7
|
+
import { ListMasterService } from './service/list-master.service';
|
|
8
|
+
import { EntityModule } from '../meta/entity.module';
|
|
9
|
+
|
|
10
|
+
@Module({
|
|
11
|
+
imports: [TypeOrmModule.forFeature([ListMasterData, ListMasterItems]),EntityModule],
|
|
12
|
+
providers: [ListMasterRepository, ListMasterItemsRepository, ListMasterService],
|
|
13
|
+
})
|
|
14
|
+
export class ListMasterModule {}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Injectable } from '@nestjs/common';
|
|
2
|
+
import { InjectRepository } from '@nestjs/typeorm';
|
|
3
|
+
import { Repository } from 'typeorm';
|
|
4
|
+
import { ListMasterItems } from '../entity/list-master-items.entity';
|
|
5
|
+
|
|
6
|
+
@Injectable()
|
|
7
|
+
export class ListMasterItemsRepository{
|
|
8
|
+
|
|
9
|
+
constructor(
|
|
10
|
+
@InjectRepository(ListMasterItems) private repo: Repository<ListMasterItems>,
|
|
11
|
+
) {}
|
|
12
|
+
|
|
13
|
+
async findItemsByType(type: string) {
|
|
14
|
+
const items = await this.repo.find({
|
|
15
|
+
where: { listtype: type, status: 'active' },
|
|
16
|
+
order: { sortindex: 'ASC' },
|
|
17
|
+
});
|
|
18
|
+
return items.map(i => ({ label: i.name, value: i.name }));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Injectable } from '@nestjs/common';
|
|
2
|
+
import { ListMasterData } from '../entity/list-master.entity';
|
|
3
|
+
import { Repository } from 'typeorm';
|
|
4
|
+
import { InjectRepository } from '@nestjs/typeorm';
|
|
5
|
+
|
|
6
|
+
@Injectable()
|
|
7
|
+
export class ListMasterRepository{
|
|
8
|
+
|
|
9
|
+
constructor(
|
|
10
|
+
@InjectRepository(ListMasterData) private readonly repo: Repository<ListMasterData>) {}
|
|
11
|
+
|
|
12
|
+
findByType(type: string) {
|
|
13
|
+
return this.repo.findOne({ where: { type } });
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { EntityServiceImpl } from '../../meta/service/entity-service-impl.service';
|
|
2
|
+
import { BadRequestException, Injectable, NotFoundException } from '@nestjs/common';
|
|
3
|
+
import { ListMasterItemsRepository } from '../repository/list-master-items.repository';
|
|
4
|
+
import { ListMasterRepository } from '../repository/list-master.repository';
|
|
5
|
+
|
|
6
|
+
@Injectable()
|
|
7
|
+
export class ListMasterService extends EntityServiceImpl {
|
|
8
|
+
constructor(
|
|
9
|
+
private readonly listMasterRepo: ListMasterRepository,
|
|
10
|
+
private readonly listItemsRepo: ListMasterItemsRepository,
|
|
11
|
+
) {
|
|
12
|
+
super();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
async getDropdownOptions(type: string) {
|
|
16
|
+
const config = await this.listMasterRepo.findByType(type);
|
|
17
|
+
|
|
18
|
+
if (!config) throw new NotFoundException(`Type ${type} not found`);
|
|
19
|
+
|
|
20
|
+
switch (config.source) {
|
|
21
|
+
case 'entity':
|
|
22
|
+
return this.fetchFromEntity(config.sourcelist);
|
|
23
|
+
|
|
24
|
+
case 'master':
|
|
25
|
+
return this.listItemsRepo.findItemsByType(type);
|
|
26
|
+
|
|
27
|
+
case 'custom':
|
|
28
|
+
// Placeholder
|
|
29
|
+
return { message: `Custom API for type ${type} not implemented` };
|
|
30
|
+
|
|
31
|
+
default:
|
|
32
|
+
throw new BadRequestException(`Unknown source: ${config.source}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
private async fetchFromEntity(sourcelist: string) {
|
|
37
|
+
if (sourcelist === 'USR') {
|
|
38
|
+
// Example: hardcoded until dynamic entity registry is done
|
|
39
|
+
return [{ label: 'User A', value: 1 }, { label: 'User B', value: 2 }];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
throw new NotFoundException(`Entity source ${sourcelist} not handled yet`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
BadRequestException,
|
|
2
3
|
Controller,
|
|
3
4
|
Post,
|
|
4
5
|
UploadedFile,
|
|
@@ -6,6 +7,7 @@ import {
|
|
|
6
7
|
} from '@nestjs/common';
|
|
7
8
|
import { FileInterceptor } from '@nestjs/platform-express';
|
|
8
9
|
import { MasterService } from '../service/master.service';
|
|
10
|
+
import { Express } from 'express';
|
|
9
11
|
|
|
10
12
|
@Controller('master')
|
|
11
13
|
export class MasterController {
|
|
@@ -19,4 +21,20 @@ export class MasterController {
|
|
|
19
21
|
}
|
|
20
22
|
return this.masterService.processExcel(file);
|
|
21
23
|
}
|
|
24
|
+
|
|
25
|
+
@Post('uploadMasterData')
|
|
26
|
+
@UseInterceptors(FileInterceptor('file'))
|
|
27
|
+
async uploadMasterDataXls(@UploadedFile() file: Express.Multer.File) {
|
|
28
|
+
if (!file) {
|
|
29
|
+
throw new BadRequestException('File is required');
|
|
30
|
+
}
|
|
31
|
+
// const tempFilePath = join(__dirname, '../../uploads', `${Date.now()}_${file.originalname}`);
|
|
32
|
+
// await writeFile(tempFilePath, file.buffer);
|
|
33
|
+
|
|
34
|
+
try {
|
|
35
|
+
await this.masterService.uploadMasterData(file.buffer);
|
|
36
|
+
} finally {
|
|
37
|
+
// FileUtil.deleteFile(tempFilePath);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
22
40
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { Injectable } from '@nestjs/common';
|
|
2
2
|
import { ExcelUtil } from '../../../utils/service/excelUtil.service';
|
|
3
3
|
import { EntityManager } from 'typeorm';
|
|
4
|
+
import { EntityMasterService } from '../../meta/service/entity-master.service';
|
|
4
5
|
|
|
5
6
|
@Injectable()
|
|
6
7
|
export class MasterService {
|
|
7
8
|
constructor(
|
|
8
9
|
private readonly entityManager: EntityManager,
|
|
10
|
+
private readonly entityMasterService: EntityMasterService,
|
|
9
11
|
private ExcelUtil: ExcelUtil,
|
|
10
12
|
) {}
|
|
11
13
|
|
|
@@ -34,4 +36,22 @@ export class MasterService {
|
|
|
34
36
|
}
|
|
35
37
|
});
|
|
36
38
|
}
|
|
39
|
+
|
|
40
|
+
async uploadMasterData(file) {
|
|
41
|
+
const data = ExcelUtil.readExcel(file.buffer);
|
|
42
|
+
await this.importEntityMasterData(data['cr_entity_master']);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
private async importEntityMasterData(entityMasterList) {
|
|
46
|
+
for (let entityMaster of entityMasterList) {
|
|
47
|
+
let existingData = await this.entityMasterService.findByMappedEntityType(entityMaster.mapped_entity_type);
|
|
48
|
+
|
|
49
|
+
if (existingData) {
|
|
50
|
+
entityMaster.id = existingData.id;
|
|
51
|
+
await this.entityMasterService.update(existingData.id, entityMaster);
|
|
52
|
+
} else {
|
|
53
|
+
await this.entityMasterService.save(entityMaster);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
37
57
|
}
|
|
@@ -11,7 +11,7 @@ import { JwtAuthGuard } from '../../auth/guards/jwt.guard';
|
|
|
11
11
|
import { Response } from 'express';
|
|
12
12
|
|
|
13
13
|
@Controller('media')
|
|
14
|
-
@UseGuards(JwtAuthGuard)
|
|
14
|
+
// @UseGuards(JwtAuthGuard)
|
|
15
15
|
export class MediaController {
|
|
16
16
|
constructor(private readonly mediaDataService: MediaDataService) {}
|
|
17
17
|
|
|
@@ -11,9 +11,11 @@ export class EntityTableRepository {
|
|
|
11
11
|
) {}
|
|
12
12
|
|
|
13
13
|
async findByEntityTypeAndListType(entityType: string, listType: string) {
|
|
14
|
-
|
|
14
|
+
const temp = await this.entityTableRepository.findOne({
|
|
15
15
|
where: { mapped_entity_type: entityType, list_type: listType },
|
|
16
16
|
});
|
|
17
|
+
console.log(temp)
|
|
18
|
+
return temp;
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
async findByEntityTypeAndListTypeAndDisplayType(
|
|
@@ -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,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();
|
|
@@ -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
|