rez_core 2.1.131 → 2.2.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/module/enterprise/controller/organization.controller.d.ts +1 -1
- package/dist/module/enterprise/controller/organization.controller.js +1 -1
- package/dist/module/enterprise/controller/organization.controller.js.map +1 -1
- package/dist/module/enterprise/enterprise.module.js +6 -27
- package/dist/module/enterprise/enterprise.module.js.map +1 -1
- package/dist/module/enterprise/entity/organization.entity.d.ts +1 -0
- package/dist/module/enterprise/entity/organization.entity.js +4 -0
- package/dist/module/enterprise/entity/organization.entity.js.map +1 -1
- package/dist/module/enterprise/repository/school.repository.d.ts +4 -6
- package/dist/module/enterprise/repository/school.repository.js +35 -33
- package/dist/module/enterprise/repository/school.repository.js.map +1 -1
- package/dist/module/enterprise/service/brand.service.d.ts +2 -1
- package/dist/module/enterprise/service/brand.service.js +2 -1
- package/dist/module/enterprise/service/brand.service.js.map +1 -1
- package/dist/module/enterprise/service/organization.service.d.ts +5 -7
- package/dist/module/enterprise/service/organization.service.js +48 -12
- package/dist/module/enterprise/service/organization.service.js.map +1 -1
- package/dist/module/filter/service/filter.service.js +1 -1
- package/dist/module/layout_preference/entity/layout_preference.entity.js +1 -1
- package/dist/module/layout_preference/entity/layout_preference.entity.js.map +1 -1
- package/dist/module/lead/controller/lead.controller.d.ts +7 -7
- package/dist/module/lead/lead.module.js +1 -5
- package/dist/module/lead/lead.module.js.map +1 -1
- package/dist/module/lead/repository/lead.repository.d.ts +5 -8
- package/dist/module/lead/repository/lead.repository.js +16 -15
- package/dist/module/lead/repository/lead.repository.js.map +1 -1
- package/dist/module/lead/service/lead.service.d.ts +7 -7
- package/dist/module/meta/entity/brand-profile.entity.d.ts +3 -0
- package/dist/module/{enterprise/entity/brand.entity.js → meta/entity/brand-profile.entity.js} +8 -15
- package/dist/module/meta/entity/brand-profile.entity.js.map +1 -0
- package/dist/module/meta/entity/field-group.entity.d.ts +0 -9
- package/dist/module/meta/entity/field-group.entity.js +0 -46
- package/dist/module/meta/entity/field-group.entity.js.map +1 -1
- package/dist/module/meta/entity/section-master.entity.d.ts +0 -10
- package/dist/module/meta/entity/section-master.entity.js +0 -50
- package/dist/module/meta/entity/section-master.entity.js.map +1 -1
- package/dist/module/meta/entity/user-app-mapping.entity.d.ts +0 -7
- package/dist/module/meta/entity/user-app-mapping.entity.js +0 -40
- package/dist/module/meta/entity/user-app-mapping.entity.js.map +1 -1
- package/dist/module/meta/entity.module.js +2 -18
- package/dist/module/meta/entity.module.js.map +1 -1
- package/dist/module/meta/repository/user-app-mapping.repository.d.ts +0 -8
- package/dist/module/meta/repository/user-app-mapping.repository.js +0 -42
- package/dist/module/meta/repository/user-app-mapping.repository.js.map +1 -1
- package/dist/module/meta/service/entity-validation.service.js +1 -1
- package/dist/module/meta/service/entity-validation.service.js.map +1 -1
- package/dist/module/meta/service/user-app-mapping.service.d.ts +0 -7
- package/dist/module/meta/service/user-app-mapping.service.js +0 -30
- package/dist/module/meta/service/user-app-mapping.service.js.map +1 -1
- package/dist/module/meta/service/view-master.service.d.ts +1 -5
- package/dist/module/meta/service/view-master.service.js +2 -34
- package/dist/module/meta/service/view-master.service.js.map +1 -1
- package/dist/module/module/repository/menu.repository.js +1 -1
- package/dist/module/module/repository/module-access.repository.js +3 -1
- package/dist/module/module/repository/module-access.repository.js.map +1 -1
- package/dist/module/module/service/module-access.service.js +1 -1
- package/dist/module/module/service/module-access.service.js.map +1 -1
- package/dist/module/notification/entity/otp.entity.js +1 -1
- package/dist/module/notification/entity/otp.entity.js.map +1 -1
- package/dist/module/third-party-module/entity/third-party-api-registry.entity.js +1 -1
- package/dist/module/third-party-module/entity/third-party-api-registry.entity.js.map +1 -1
- package/dist/module/user/service/login.service.js +1 -1
- package/dist/module/user/service/login.service.js.map +1 -1
- package/dist/module/user/service/user-session.service.js +1 -1
- package/dist/module/user/service/user-session.service.js.map +1 -1
- package/dist/module/user/service/user.service.d.ts +1 -3
- package/dist/module/user/service/user.service.js +3 -6
- package/dist/module/user/service/user.service.js.map +1 -1
- package/dist/module/workflow/controller/workflow.controller.d.ts +16 -0
- package/dist/module/workflow/controller/workflow.controller.js +66 -0
- package/dist/module/workflow/controller/workflow.controller.js.map +1 -0
- package/dist/module/workflow/service/action-template-mapping.service.js +7 -5
- package/dist/module/workflow/service/action-template-mapping.service.js.map +1 -1
- package/dist/module/workflow/service/workflow.service.d.ts +9 -3
- package/dist/module/workflow/service/workflow.service.js +57 -5
- package/dist/module/workflow/service/workflow.service.js.map +1 -1
- package/dist/module/workflow/workflow.module.js +7 -3
- package/dist/module/workflow/workflow.module.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utils/service/wbsCodeGen.service.d.ts +3 -0
- package/dist/{module/enterprise/service/school.service.js → utils/service/wbsCodeGen.service.js} +9 -7
- package/dist/utils/service/wbsCodeGen.service.js.map +1 -0
- package/dist/utils/utils.module.js +15 -2
- package/dist/utils/utils.module.js.map +1 -1
- package/package.json +1 -1
- package/src/module/enterprise/controller/organization.controller.ts +1 -2
- package/src/module/enterprise/enterprise.module.ts +6 -27
- package/src/module/enterprise/entity/organization.entity.ts +3 -0
- package/src/module/enterprise/repository/school.repository.ts +44 -31
- package/src/module/enterprise/service/brand.service.ts +2 -1
- package/src/module/enterprise/service/organization.service.ts +63 -10
- package/src/module/filter/service/filter.service.ts +1 -1
- package/src/module/layout_preference/entity/layout_preference.entity.ts +1 -1
- package/src/module/lead/lead.module.ts +1 -5
- package/src/module/lead/repository/lead.repository.ts +19 -15
- package/src/module/meta/entity/brand-profile.entity.ts +5 -0
- package/src/module/meta/entity/field-group.entity.ts +20 -20
- package/src/module/meta/entity/section-master.entity.ts +22 -22
- package/src/module/meta/entity/user-app-mapping.entity.ts +16 -16
- package/src/module/meta/entity.module.ts +20 -18
- package/src/module/meta/repository/user-app-mapping.repository.ts +25 -26
- package/src/module/meta/service/entity-validation.service.ts +1 -1
- package/src/module/meta/service/user-app-mapping.service.ts +14 -14
- package/src/module/meta/service/view-master.service.ts +38 -38
- package/src/module/module/repository/menu.repository.ts +1 -1
- package/src/module/module/repository/module-access.repository.ts +23 -33
- package/src/module/module/service/module-access.service.ts +1 -1
- package/src/module/notification/entity/otp.entity.ts +3 -3
- package/src/module/third-party-module/entity/third-party-api-registry.entity.ts +2 -2
- package/src/module/user/service/login.service.ts +1 -1
- package/src/module/user/service/user-session.service.ts +1 -1
- package/src/module/user/service/user.service.ts +2 -2
- package/src/module/workflow/controller/workflow.controller.ts +47 -0
- package/src/module/workflow/service/action-template-mapping.service.ts +8 -5
- package/src/module/workflow/service/workflow.service.ts +76 -5
- package/src/module/workflow/workflow.module.ts +7 -3
- package/src/resources/dev.properties.yaml +3 -3
- package/src/utils/service/wbsCodeGen.service.ts +8 -0
- package/src/utils/utils.module.ts +15 -2
- package/dist/module/enterprise/entity/brand.entity.d.ts +0 -4
- package/dist/module/enterprise/entity/brand.entity.js.map +0 -1
- package/dist/module/enterprise/entity/school.entity.d.ts +0 -7
- package/dist/module/enterprise/entity/school.entity.js +0 -37
- package/dist/module/enterprise/entity/school.entity.js.map +0 -1
- package/dist/module/enterprise/repository/brand.repository.d.ts +0 -8
- package/dist/module/enterprise/repository/brand.repository.js +0 -39
- package/dist/module/enterprise/repository/brand.repository.js.map +0 -1
- package/dist/module/enterprise/service/school.service.d.ts +0 -3
- package/dist/module/enterprise/service/school.service.js.map +0 -1
- package/src/module/enterprise/entity/brand.entity.ts +0 -8
- package/src/module/enterprise/entity/school.entity.ts +0 -17
- package/src/module/enterprise/repository/brand.repository.ts +0 -23
- package/src/module/enterprise/service/school.service.ts +0 -5
package/dist/{module/enterprise/service/school.service.js → utils/service/wbsCodeGen.service.js}
RENAMED
|
@@ -6,13 +6,15 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
7
|
};
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
9
|
+
exports.WBSCodeGenService = void 0;
|
|
10
10
|
const common_1 = require("@nestjs/common");
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
let WBSCodeGenService = class WBSCodeGenService {
|
|
12
|
+
padCode(num) {
|
|
13
|
+
return num.toString().padStart(5, '0');
|
|
14
|
+
}
|
|
13
15
|
};
|
|
14
|
-
exports.
|
|
15
|
-
exports.
|
|
16
|
+
exports.WBSCodeGenService = WBSCodeGenService;
|
|
17
|
+
exports.WBSCodeGenService = WBSCodeGenService = __decorate([
|
|
16
18
|
(0, common_1.Injectable)()
|
|
17
|
-
],
|
|
18
|
-
//# sourceMappingURL=
|
|
19
|
+
], WBSCodeGenService);
|
|
20
|
+
//# sourceMappingURL=wbsCodeGen.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wbsCodeGen.service.js","sourceRoot":"","sources":["../../../src/utils/service/wbsCodeGen.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAoD;AAG7C,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAC5B,OAAO,CAAC,GAAW;QACjB,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACzC,CAAC;CACF,CAAA;AAJY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;GACA,iBAAiB,CAI7B"}
|
|
@@ -12,14 +12,27 @@ const loggingUtil_service_1 = require("./service/loggingUtil.service");
|
|
|
12
12
|
const reflection_helper_service_1 = require("./service/reflection-helper.service");
|
|
13
13
|
const excelUtil_service_1 = require("./service/excelUtil.service");
|
|
14
14
|
const clockIDGenUtil_service_1 = require("./service/clockIDGenUtil.service");
|
|
15
|
+
const wbsCodeGen_service_1 = require("./service/wbsCodeGen.service");
|
|
15
16
|
let UtilsModule = class UtilsModule {
|
|
16
17
|
};
|
|
17
18
|
exports.UtilsModule = UtilsModule;
|
|
18
19
|
exports.UtilsModule = UtilsModule = __decorate([
|
|
19
20
|
(0, common_1.Global)(),
|
|
20
21
|
(0, common_1.Module)({
|
|
21
|
-
providers: [
|
|
22
|
-
|
|
22
|
+
providers: [
|
|
23
|
+
loggingUtil_service_1.LoggingService,
|
|
24
|
+
reflection_helper_service_1.ReflectionHelper,
|
|
25
|
+
excelUtil_service_1.ExcelUtil,
|
|
26
|
+
clockIDGenUtil_service_1.ClockIDGenService,
|
|
27
|
+
wbsCodeGen_service_1.WBSCodeGenService,
|
|
28
|
+
],
|
|
29
|
+
exports: [
|
|
30
|
+
loggingUtil_service_1.LoggingService,
|
|
31
|
+
reflection_helper_service_1.ReflectionHelper,
|
|
32
|
+
excelUtil_service_1.ExcelUtil,
|
|
33
|
+
clockIDGenUtil_service_1.ClockIDGenService,
|
|
34
|
+
wbsCodeGen_service_1.WBSCodeGenService,
|
|
35
|
+
],
|
|
23
36
|
})
|
|
24
37
|
], UtilsModule);
|
|
25
38
|
//# sourceMappingURL=utils.module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.module.js","sourceRoot":"","sources":["../../src/utils/utils.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAgD;AAChD,uEAA+D;AAC/D,mFAAuE;AACvE,mEAAwD;AACxD,6EAAqE;
|
|
1
|
+
{"version":3,"file":"utils.module.js","sourceRoot":"","sources":["../../src/utils/utils.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAgD;AAChD,uEAA+D;AAC/D,mFAAuE;AACvE,mEAAwD;AACxD,6EAAqE;AACrE,qEAAiE;AAmB1D,IAAM,WAAW,GAAjB,MAAM,WAAW;CAAG,CAAA;AAAd,kCAAW;sBAAX,WAAW;IAjBvB,IAAA,eAAM,GAAE;IACR,IAAA,eAAM,EAAC;QACN,SAAS,EAAE;YACT,oCAAc;YACd,4CAAgB;YAChB,6BAAS;YACT,0CAAiB;YACjB,sCAAiB;SAClB;QACD,OAAO,EAAE;YACP,oCAAc;YACd,4CAAgB;YAChB,6BAAS;YACT,0CAAiB;YACjB,sCAAiB;SAClB;KACF,CAAC;GACW,WAAW,CAAG"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Controller, Get, Inject, Req, UseGuards } from '@nestjs/common';
|
|
2
|
-
import { OrganizationService } from '../service/organization.service';
|
|
3
2
|
import { Request } from 'express';
|
|
4
3
|
import { JwtAuthGuard } from 'src/module/auth/guards/jwt.guard';
|
|
5
4
|
import { UserService } from 'src/module/user/service/user.service';
|
|
6
|
-
import {
|
|
5
|
+
import { OrganizationService } from '../service/organization.service';
|
|
7
6
|
|
|
8
7
|
@Controller('organization')
|
|
9
8
|
export class OrganizationController {
|
|
@@ -1,29 +1,18 @@
|
|
|
1
1
|
import { forwardRef, Module } from '@nestjs/common';
|
|
2
2
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
|
3
|
-
import { OrganizationService } from './service/organization.service';
|
|
4
|
-
import { OrganizationData } from './entity/organization.entity';
|
|
5
|
-
import { OrganizationController } from './controller/organization.controller';
|
|
6
3
|
import { UserModule } from '../user/user.module';
|
|
7
|
-
import {
|
|
4
|
+
import { OrganizationController } from './controller/organization.controller';
|
|
8
5
|
import { OrganizationAppMapping } from './entity/organization-app-mapping.entity';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { SchoolRepository } from './repository/school.repository';
|
|
6
|
+
import { OrganizationData } from './entity/organization.entity';
|
|
7
|
+
import { OrganizationAppMappingService } from './service/organization-app-mapping.service';
|
|
8
|
+
import { OrganizationService } from './service/organization.service';
|
|
13
9
|
import { UtilsModule } from 'src/utils/utils.module';
|
|
14
|
-
import { BrandService } from './service/brand.service';
|
|
15
|
-
import { OrganizationRepository } from './repository/organization.repository';
|
|
16
|
-
import { SchoolService } from './service/school.service';
|
|
17
10
|
import { EntityModule } from '../meta/entity.module';
|
|
11
|
+
import { OrganizationRepository } from './repository/organization.repository';
|
|
18
12
|
|
|
19
13
|
@Module({
|
|
20
14
|
imports: [
|
|
21
|
-
TypeOrmModule.forFeature([
|
|
22
|
-
OrganizationData,
|
|
23
|
-
OrganizationAppMapping,
|
|
24
|
-
BrandData,
|
|
25
|
-
SchoolData,
|
|
26
|
-
]),
|
|
15
|
+
TypeOrmModule.forFeature([OrganizationData, OrganizationAppMapping]),
|
|
27
16
|
forwardRef(() => UserModule),
|
|
28
17
|
UtilsModule,
|
|
29
18
|
EntityModule,
|
|
@@ -32,17 +21,7 @@ import { EntityModule } from '../meta/entity.module';
|
|
|
32
21
|
providers: [
|
|
33
22
|
OrganizationService,
|
|
34
23
|
OrganizationAppMappingService,
|
|
35
|
-
BrandRepository,
|
|
36
|
-
SchoolRepository,
|
|
37
24
|
OrganizationRepository,
|
|
38
|
-
{
|
|
39
|
-
provide: 'BrandService',
|
|
40
|
-
useClass: BrandService,
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
provide: 'SchoolService',
|
|
44
|
-
useClass: SchoolService,
|
|
45
|
-
},
|
|
46
25
|
],
|
|
47
26
|
exports: [OrganizationService, OrganizationRepository],
|
|
48
27
|
})
|
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
import { Injectable } from '@nestjs/common';
|
|
2
|
-
import { InjectRepository } from '@nestjs/typeorm';
|
|
2
|
+
// import { InjectRepository } from '@nestjs/typeorm';
|
|
3
3
|
import { DataSource, Repository } from 'typeorm';
|
|
4
|
-
import { SchoolData } from '../entity/school.entity';
|
|
4
|
+
// import { SchoolData } from '../entity/school.entity';
|
|
5
5
|
import { UserRoleMapping } from 'src/module/user/entity/user-role-mapping.entity';
|
|
6
6
|
|
|
7
7
|
@Injectable()
|
|
8
8
|
export class SchoolRepository {
|
|
9
|
-
constructor(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
});
|
|
9
|
+
constructor(private readonly dataSource: DataSource) {}
|
|
10
|
+
|
|
11
|
+
async findAllByOrgId(orgId: number): Promise<any[]> {
|
|
12
|
+
return await this.dataSource
|
|
13
|
+
.createQueryBuilder()
|
|
14
|
+
.select(['*'])
|
|
15
|
+
.from('eth_school_profile', 'sch')
|
|
16
|
+
.where('sch.organization_id = :orgId', { orgId })
|
|
17
|
+
.getRawMany();
|
|
19
18
|
}
|
|
20
19
|
|
|
21
|
-
async findAllByBrandId(brdId: number): Promise<
|
|
22
|
-
return await this.
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
async findAllByBrandId(brdId: number): Promise<any[]> {
|
|
21
|
+
return await this.dataSource
|
|
22
|
+
.createQueryBuilder()
|
|
23
|
+
.select(['*'])
|
|
24
|
+
.from('eth_school_profile', 'sch')
|
|
25
|
+
.where('sch.brand_id = :brdId', { brdId })
|
|
26
|
+
.getRawMany();
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
async getUserContextDropdown(userId: number, appCode: string, org_id) {
|
|
@@ -34,6 +36,8 @@ export class SchoolRepository {
|
|
|
34
36
|
.andWhere('urm.level_type = :levelType', { levelType: 'ORG' })
|
|
35
37
|
.getRawMany();
|
|
36
38
|
|
|
39
|
+
console.log('hasOrgAccess', hasOrgAccess);
|
|
40
|
+
|
|
37
41
|
let currentORGLevel_id = hasOrgAccess[0]?.urm_level_id;
|
|
38
42
|
if (hasOrgAccess[0]?.urm_level_id == 1) {
|
|
39
43
|
currentORGLevel_id = org_id;
|
|
@@ -47,18 +51,27 @@ export class SchoolRepository {
|
|
|
47
51
|
'org.name AS org_name',
|
|
48
52
|
'org.address AS org_address',
|
|
49
53
|
'org.status AS org_status',
|
|
50
|
-
|
|
51
|
-
'
|
|
52
|
-
'
|
|
53
|
-
'
|
|
54
|
-
|
|
55
|
-
'
|
|
56
|
-
'
|
|
54
|
+
|
|
55
|
+
'brn.id AS brand_id',
|
|
56
|
+
'brand_profile.name AS brand_name',
|
|
57
|
+
'brand_profile.status AS brand_status',
|
|
58
|
+
|
|
59
|
+
'school.id AS school_id',
|
|
60
|
+
'school.name AS school_name',
|
|
61
|
+
'school.location AS school_location',
|
|
62
|
+
'school.status AS school_status',
|
|
57
63
|
])
|
|
58
|
-
.from('
|
|
59
|
-
.innerJoin('
|
|
60
|
-
.innerJoin(
|
|
61
|
-
|
|
64
|
+
.from('cr_organization', 'org')
|
|
65
|
+
.innerJoin('cr_organization', 'brn', "brn.type = 'BRN'")
|
|
66
|
+
.innerJoin(
|
|
67
|
+
'eth_brand_profile',
|
|
68
|
+
'brand_profile',
|
|
69
|
+
'brand_profile.parent_id = brn.id AND brand_profile.organization_id = org.id',
|
|
70
|
+
)
|
|
71
|
+
.innerJoin('eth_school_profile', 'school', 'school.brand_id = brn.id')
|
|
72
|
+
.where('org.id = :orgId', {
|
|
73
|
+
orgId: currentORGLevel_id,
|
|
74
|
+
})
|
|
62
75
|
.getRawMany();
|
|
63
76
|
|
|
64
77
|
if (schools.length > 0) {
|
|
@@ -175,8 +188,8 @@ export class SchoolRepository {
|
|
|
175
188
|
'school.status AS school_status',
|
|
176
189
|
])
|
|
177
190
|
.from('cr_user_role_mapping', 'urm')
|
|
178
|
-
.innerJoin('
|
|
179
|
-
.innerJoin('
|
|
191
|
+
.innerJoin('cr_organization', 'brand', 'brand.id = urm.level_id')
|
|
192
|
+
.innerJoin('eth_school_profile', 'school', 'school.brand_id = brand.id')
|
|
180
193
|
.where('urm.user_id = :userId', { userId })
|
|
181
194
|
.andWhere('urm.appcode = :appCode', { appCode })
|
|
182
195
|
.andWhere('urm.level_type = :levelType', { levelType: 'BRN' })
|
|
@@ -194,8 +207,8 @@ export class SchoolRepository {
|
|
|
194
207
|
'school.status AS school_status',
|
|
195
208
|
])
|
|
196
209
|
.from('cr_user_role_mapping', 'urm')
|
|
197
|
-
.innerJoin('
|
|
198
|
-
.innerJoin('
|
|
210
|
+
.innerJoin('eth_school_profile', 'school', 'school.id = urm.level_id')
|
|
211
|
+
.innerJoin('cr_organization', 'brand', 'brand.id = school.brand_id')
|
|
199
212
|
.where('urm.user_id = :userId', { userId })
|
|
200
213
|
.andWhere('urm.appcode = :appCode', { appCode })
|
|
201
214
|
.andWhere('urm.level_type = :levelType', { levelType: 'SCH' })
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Injectable } from '@nestjs/common';
|
|
2
2
|
import { InjectRepository } from '@nestjs/typeorm';
|
|
3
|
-
import { EntityManager, Repository } from 'typeorm';
|
|
4
|
-
import { OrganizationData } from '../entity/organization.entity';
|
|
5
3
|
import { ClockIDGenService } from 'src/utils/service/clockIDGenUtil.service';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { BrandRepository } from '../repository/brand.repository';
|
|
4
|
+
import { EntityManager, IsNull, Repository } from 'typeorm';
|
|
5
|
+
import { OrganizationData } from '../entity/organization.entity';
|
|
6
|
+
// import { BrandRepository } from '../repository/brand.repository';
|
|
7
|
+
import { WBSCodeGenService } from 'src/utils/service/wbsCodeGen.service';
|
|
9
8
|
import { SchoolRepository } from '../repository/school.repository';
|
|
10
9
|
|
|
11
10
|
@Injectable()
|
|
@@ -13,10 +12,9 @@ export class OrganizationService {
|
|
|
13
12
|
constructor(
|
|
14
13
|
@InjectRepository(OrganizationData)
|
|
15
14
|
private readonly organizationRepository: Repository<OrganizationData>,
|
|
16
|
-
private readonly brandRepository: BrandRepository,
|
|
17
|
-
private readonly schoolRepository: SchoolRepository,
|
|
18
15
|
private readonly idGen: ClockIDGenService,
|
|
19
|
-
|
|
16
|
+
private readonly wbcCodeGenService: WBSCodeGenService,
|
|
17
|
+
private readonly schoolRepository: SchoolRepository,
|
|
20
18
|
) {}
|
|
21
19
|
|
|
22
20
|
async create(
|
|
@@ -27,9 +25,64 @@ export class OrganizationService {
|
|
|
27
25
|
? manager.getRepository(OrganizationData)
|
|
28
26
|
: this.organizationRepository;
|
|
29
27
|
|
|
28
|
+
const isBrand = organizationDto.type === 'BRN';
|
|
29
|
+
|
|
30
|
+
if (isBrand) {
|
|
31
|
+
// BRN case
|
|
32
|
+
const parentOrgId = organizationDto.parent_id;
|
|
33
|
+
|
|
34
|
+
if (!parentOrgId) {
|
|
35
|
+
throw new Error('Parent Org ID is required to create a brand.');
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const parentOrg = await repo.findOne({
|
|
39
|
+
where: { id: parentOrgId },
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
if (!parentOrg) {
|
|
43
|
+
throw new Error('Parent organization not found.');
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const existingBrands = await repo.find({
|
|
47
|
+
where: {
|
|
48
|
+
type: 'BRN',
|
|
49
|
+
parent_id: parentOrgId,
|
|
50
|
+
},
|
|
51
|
+
select: ['wbs_code'],
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const brandCodes = existingBrands
|
|
55
|
+
.map((b) => b.wbs_code?.split('.')[1])
|
|
56
|
+
.filter(Boolean)
|
|
57
|
+
.map(Number);
|
|
58
|
+
|
|
59
|
+
const nextBrnCode = brandCodes.length ? Math.max(...brandCodes) + 1 : 1;
|
|
60
|
+
|
|
61
|
+
const brnWbsCode = this.wbcCodeGenService.padCode(nextBrnCode);
|
|
62
|
+
organizationDto.wbs_code = `${parentOrg.wbs_code}.${brnWbsCode}`;
|
|
63
|
+
} else {
|
|
64
|
+
// ORG case
|
|
65
|
+
const existingOrgs = await repo.find({
|
|
66
|
+
where: {
|
|
67
|
+
type: IsNull(),
|
|
68
|
+
},
|
|
69
|
+
select: ['wbs_code'],
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
const orgCodes = existingOrgs
|
|
73
|
+
.map((org) => org.wbs_code)
|
|
74
|
+
.filter(Boolean)
|
|
75
|
+
.map(Number);
|
|
76
|
+
|
|
77
|
+
const nextOrgCode = orgCodes.length ? Math.max(...orgCodes) + 1 : 1;
|
|
78
|
+
|
|
79
|
+
organizationDto.wbs_code = this.wbcCodeGenService.padCode(nextOrgCode);
|
|
80
|
+
}
|
|
81
|
+
|
|
30
82
|
organizationDto.code = this.idGen.idGenerator('ORG');
|
|
31
|
-
organizationDto.status = 'ACTIVE';
|
|
83
|
+
// organizationDto.status = 'ACTIVE';
|
|
32
84
|
organizationDto.created_date = new Date();
|
|
85
|
+
|
|
33
86
|
const organization = repo.create(organizationDto);
|
|
34
87
|
return await repo.save(organization);
|
|
35
88
|
}
|
|
@@ -163,7 +163,7 @@ export class FilterService {
|
|
|
163
163
|
// layout preference query
|
|
164
164
|
const layoutPreference = await this.dataSource.query(
|
|
165
165
|
`SELECT layout_json
|
|
166
|
-
FROM
|
|
166
|
+
FROM cr_entity_layout_pref
|
|
167
167
|
WHERE user_id = ? AND mapped_entity_type = ?`,
|
|
168
168
|
[user_id, entity_type],
|
|
169
169
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseEntity } from 'src/module/meta/entity/base-entity.entity';
|
|
2
2
|
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
|
|
3
3
|
|
|
4
|
-
@Entity({ name: '
|
|
4
|
+
@Entity({ name: 'cr_entity_layout_pref' })
|
|
5
5
|
export class LayoutPreference extends BaseEntity {
|
|
6
6
|
@Column({ length: 50, nullable: true })
|
|
7
7
|
user_id: string;
|
|
@@ -4,13 +4,9 @@ import { LeadService } from './service/lead.service';
|
|
|
4
4
|
import { LeadRepository } from './repository/lead.repository';
|
|
5
5
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
|
6
6
|
import { OrganizationData } from '../enterprise/entity/organization.entity';
|
|
7
|
-
import { BrandData } from '../enterprise/entity/brand.entity';
|
|
8
|
-
import { SchoolData } from '../enterprise/entity/school.entity';
|
|
9
7
|
|
|
10
8
|
@Module({
|
|
11
|
-
imports: [
|
|
12
|
-
TypeOrmModule.forFeature([OrganizationData, BrandData, SchoolData]),
|
|
13
|
-
],
|
|
9
|
+
imports: [TypeOrmModule.forFeature([OrganizationData])],
|
|
14
10
|
providers: [LeadService, LeadRepository],
|
|
15
11
|
controllers: [],
|
|
16
12
|
exports: [LeadService],
|
|
@@ -1,37 +1,41 @@
|
|
|
1
1
|
import { Injectable } from '@nestjs/common';
|
|
2
2
|
import { InjectRepository } from '@nestjs/typeorm';
|
|
3
|
-
import { BrandData } from 'src/module/enterprise/entity/brand.entity';
|
|
3
|
+
// import { BrandData } from 'src/module/enterprise/entity/brand.entity';
|
|
4
4
|
import { OrganizationData } from 'src/module/enterprise/entity/organization.entity';
|
|
5
|
-
import { SchoolData } from 'src/module/enterprise/entity/school.entity';
|
|
6
|
-
import { Repository } from 'typeorm';
|
|
5
|
+
// import { SchoolData } from 'src/module/enterprise/entity/school.entity';
|
|
6
|
+
import { DataSource, Repository } from 'typeorm';
|
|
7
7
|
|
|
8
8
|
@Injectable()
|
|
9
9
|
export class LeadRepository {
|
|
10
10
|
constructor(
|
|
11
11
|
@InjectRepository(OrganizationData)
|
|
12
12
|
private organizationRepository: Repository<OrganizationData>,
|
|
13
|
-
|
|
14
|
-
private brandRepository: Repository<BrandData>,
|
|
15
|
-
@InjectRepository(SchoolData)
|
|
16
|
-
private schoolRepository: Repository<SchoolData>,
|
|
13
|
+
private readonly dataSource: DataSource,
|
|
17
14
|
) {}
|
|
18
15
|
|
|
19
16
|
async getAllOrganizations(): Promise<OrganizationData[]> {
|
|
20
17
|
return this.organizationRepository.find();
|
|
21
18
|
}
|
|
22
19
|
|
|
23
|
-
async getBrandsByOrganization(organization_id: number): Promise<
|
|
24
|
-
return this.
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
async getBrandsByOrganization(organization_id: number): Promise<any[]> {
|
|
21
|
+
return await this.dataSource
|
|
22
|
+
.createQueryBuilder()
|
|
23
|
+
.select(['*'])
|
|
24
|
+
.from('eth_brand_profile', 'brd')
|
|
25
|
+
.where('brd.organization_id = :orgId', { orgId: organization_id })
|
|
26
|
+
.getRawMany();
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
async getSchoolsByBrandAndOrganization(
|
|
30
30
|
brand_id: number,
|
|
31
31
|
organization_id: number,
|
|
32
|
-
): Promise<
|
|
33
|
-
return this.
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
): Promise<any[]> {
|
|
33
|
+
return await this.dataSource
|
|
34
|
+
.createQueryBuilder()
|
|
35
|
+
.select(['*'])
|
|
36
|
+
.from('eth_school_profile', 'sch')
|
|
37
|
+
.where('sch.brand_id = :brdId', { brdId: brand_id })
|
|
38
|
+
.andWhere('sch.organization_id = :orgId', { orgId: organization_id })
|
|
39
|
+
.getRawMany();
|
|
36
40
|
}
|
|
37
41
|
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { ENTITYTYPE_FIELDMASTER } from 'src/constant/global.constant';
|
|
2
|
-
import { BaseEntity } from './base-entity.entity';
|
|
3
|
-
import { Column, Entity } from 'typeorm';
|
|
1
|
+
// import { ENTITYTYPE_FIELDMASTER } from 'src/constant/global.constant';
|
|
2
|
+
// import { BaseEntity } from './base-entity.entity';
|
|
3
|
+
// import { Column, Entity } from 'typeorm';
|
|
4
4
|
|
|
5
|
-
@Entity({ name: 'cr_field_group' })
|
|
6
|
-
export class FieldGroup extends BaseEntity {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
// @Entity({ name: 'cr_field_group' })
|
|
6
|
+
// export class FieldGroup extends BaseEntity {
|
|
7
|
+
// constructor() {
|
|
8
|
+
// super();
|
|
9
|
+
// this.entity_type = ENTITYTYPE_FIELDMASTER;
|
|
10
|
+
// }
|
|
11
|
+
// @Column({ length: 50, nullable: true })
|
|
12
|
+
// mapped_entity_type: string;
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
// @Column({ length: 50, nullable: true })
|
|
15
|
+
// field_type: string;
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
// @Column({ nullable: true })
|
|
18
|
+
// description: string;
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
// @Column({ type: 'varchar', nullable: true })
|
|
21
|
+
// label: string;
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
23
|
+
// @Column({ type: 'int', nullable: true })
|
|
24
|
+
// view_id: number;
|
|
25
|
+
// }
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { ENTITYTYPE_SECTIONMASTER } from 'src/constant/global.constant';
|
|
2
|
-
import { BaseEntity } from './base-entity.entity';
|
|
3
|
-
import { Column, Entity } from 'typeorm';
|
|
1
|
+
// import { ENTITYTYPE_SECTIONMASTER } from 'src/constant/global.constant';
|
|
2
|
+
// import { BaseEntity } from './base-entity.entity';
|
|
3
|
+
// import { Column, Entity } from 'typeorm';
|
|
4
4
|
|
|
5
|
-
@Entity({ name: 'cr_section_master' })
|
|
6
|
-
export class SectionMaster extends BaseEntity {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
// @Entity({ name: 'cr_section_master' })
|
|
6
|
+
// export class SectionMaster extends BaseEntity {
|
|
7
|
+
// constructor() {
|
|
8
|
+
// super();
|
|
9
|
+
// this.entity_type = ENTITYTYPE_SECTIONMASTER;
|
|
10
|
+
// }
|
|
11
|
+
// @Column({ length: 50, nullable: true })
|
|
12
|
+
// mapped_entity_type: string;
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
// @Column({ length: 50, nullable: true })
|
|
15
|
+
// section_type: string;
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
// @Column({ nullable: true })
|
|
18
|
+
// description: string;
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
// @Column({ type: 'varchar', nullable: true })
|
|
21
|
+
// tooltip: string;
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
// @Column({ type: 'int', nullable: true })
|
|
24
|
+
// visible_in_add: number;
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
26
|
+
// @Column({ type: 'int', nullable: true })
|
|
27
|
+
// position: number;
|
|
28
|
+
// }
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
|
|
1
|
+
// import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
|
|
2
2
|
|
|
3
|
-
@Entity({ name: 'cr_user_app_mapping' })
|
|
4
|
-
export class UserAppMapping {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
// @Entity({ name: 'cr_user_app_mapping' })
|
|
4
|
+
// export class UserAppMapping {
|
|
5
|
+
// constructor(user_id: number) {
|
|
6
|
+
// this.user_id = user_id;
|
|
7
|
+
// this.entity_type = 'UAP';
|
|
8
|
+
// }
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
// @PrimaryGeneratedColumn()
|
|
11
|
+
// id: number;
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
// @Column({ type: 'bigint', nullable: true })
|
|
14
|
+
// user_id: number;
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
// @Column({ type: 'varchar', nullable: true })
|
|
17
|
+
// appcode: string;
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
19
|
+
// @Column({ type: 'varchar' })
|
|
20
|
+
// entity_type: string;
|
|
21
|
+
// }
|