rez_core 2.0.80 → 2.0.82
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/app.module.js +2 -0
- package/dist/app.module.js.map +1 -1
- package/dist/module/filter/service/filter.service.js.map +1 -1
- package/dist/module/layout_preference/controller/layout_preference.controller.d.ts +8 -0
- package/dist/module/layout_preference/controller/layout_preference.controller.js +43 -0
- package/dist/module/layout_preference/controller/layout_preference.controller.js.map +1 -0
- package/dist/module/layout_preference/dto/layout_preference.dto.d.ts +0 -0
- package/dist/module/layout_preference/dto/layout_preference.dto.js +1 -0
- package/dist/module/layout_preference/dto/layout_preference.dto.js.map +1 -0
- package/dist/module/layout_preference/entity/layout_preference.entity.d.ts +6 -0
- package/dist/module/layout_preference/entity/layout_preference.entity.js +33 -0
- package/dist/module/layout_preference/entity/layout_preference.entity.js.map +1 -0
- package/dist/module/layout_preference/layout_preference.module.d.ts +2 -0
- package/dist/module/layout_preference/layout_preference.module.js +30 -0
- package/dist/module/layout_preference/layout_preference.module.js.map +1 -0
- package/dist/module/layout_preference/repository/layout_preference.repository.d.ts +7 -0
- package/dist/module/layout_preference/repository/layout_preference.repository.js +39 -0
- package/dist/module/layout_preference/repository/layout_preference.repository.js.map +1 -0
- package/dist/module/layout_preference/service/layout_preference.service.d.ts +10 -0
- package/dist/module/layout_preference/service/layout_preference.service.js +44 -0
- package/dist/module/layout_preference/service/layout_preference.service.js.map +1 -0
- package/dist/module/meta/service/entity-table.service.js +1 -0
- package/dist/module/meta/service/entity-table.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/app.module.ts +2 -0
- package/src/module/filter/service/filter.service.ts +0 -2
- package/src/module/layout_preference/controller/layout_preference.controller.ts +33 -0
- package/src/module/layout_preference/dto/layout_preference.dto.ts +0 -0
- package/src/module/layout_preference/entity/layout_preference.entity.ts +14 -0
- package/src/module/layout_preference/layout_preference.module.ts +17 -0
- package/src/module/layout_preference/repository/layout_preference.repository.ts +24 -0
- package/src/module/layout_preference/service/layout_preference.service.ts +47 -0
- package/src/module/meta/service/entity-table.service.ts +1 -0
package/package.json
CHANGED
package/src/app.module.ts
CHANGED
|
@@ -12,6 +12,7 @@ import { ListMasterModule } from './module/listmaster/listmaster.module';
|
|
|
12
12
|
import { ThirdPartyModule } from './module/third-party-module/third-party.module';
|
|
13
13
|
import { FilterModule } from './module/filter/filter.module';
|
|
14
14
|
import { LeadModule } from './module/lead/lead.module';
|
|
15
|
+
import { LayoutPreferenceModule } from './module/layout_preference/layout_preference.module';
|
|
15
16
|
|
|
16
17
|
@Module({
|
|
17
18
|
imports: [
|
|
@@ -28,6 +29,7 @@ import { LeadModule } from './module/lead/lead.module';
|
|
|
28
29
|
ThirdPartyModule,
|
|
29
30
|
FilterModule,
|
|
30
31
|
LeadModule,
|
|
32
|
+
LayoutPreferenceModule,
|
|
31
33
|
],
|
|
32
34
|
})
|
|
33
35
|
export class AppModule {}
|
|
@@ -21,7 +21,6 @@ export class FilterService {
|
|
|
21
21
|
) {}
|
|
22
22
|
private readonly skipLevelFilterEntities = ['USR','UPR'];
|
|
23
23
|
|
|
24
|
-
|
|
25
24
|
private async gettab_value_counts(
|
|
26
25
|
tableName: string,
|
|
27
26
|
column: string | undefined,
|
|
@@ -142,7 +141,6 @@ export class FilterService {
|
|
|
142
141
|
},
|
|
143
142
|
});
|
|
144
143
|
}
|
|
145
|
-
|
|
146
144
|
|
|
147
145
|
// Build query for tab counts (no tab.value filter here)
|
|
148
146
|
const allTabs = await this.gettab_value_counts(
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Controller,
|
|
3
|
+
Get,
|
|
4
|
+
Inject,
|
|
5
|
+
Param,
|
|
6
|
+
Query,
|
|
7
|
+
Req,
|
|
8
|
+
UseGuards,
|
|
9
|
+
} from '@nestjs/common';
|
|
10
|
+
import { LayoutPreferenceService } from '../service/layout_preference.service';
|
|
11
|
+
import { JwtAuthGuard } from 'src/module/auth/guards/jwt.guard';
|
|
12
|
+
|
|
13
|
+
@Controller('layout-preference')
|
|
14
|
+
export class LayoutPreferenceController {
|
|
15
|
+
constructor(
|
|
16
|
+
@Inject('LayoutPreferenceService')
|
|
17
|
+
private readonly layoutPreferenceService: LayoutPreferenceService,
|
|
18
|
+
) {}
|
|
19
|
+
|
|
20
|
+
@Get('')
|
|
21
|
+
@UseGuards(JwtAuthGuard)
|
|
22
|
+
async getFilterById(
|
|
23
|
+
@Query('entity_type') entity_type: string,
|
|
24
|
+
@Req() req: Request & { user: any },
|
|
25
|
+
) {
|
|
26
|
+
const userId = req.user.userData.id;
|
|
27
|
+
|
|
28
|
+
return this.layoutPreferenceService.getLayoutPreferenceByUserID(
|
|
29
|
+
userId,
|
|
30
|
+
entity_type,
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseEntity } from 'src/module/meta/entity/base-entity.entity';
|
|
2
|
+
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
|
|
3
|
+
|
|
4
|
+
@Entity({ name: 'cr_layout_preference' })
|
|
5
|
+
export class LayoutPreference extends BaseEntity {
|
|
6
|
+
@Column({ length: 50, nullable: true })
|
|
7
|
+
user_id: string;
|
|
8
|
+
|
|
9
|
+
@Column({ nullable: true, type: 'json' })
|
|
10
|
+
layout_json: any;
|
|
11
|
+
|
|
12
|
+
@Column({ length: 50, nullable: true, type: 'varchar' })
|
|
13
|
+
mapped_entity_type: string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Module } from '@nestjs/common';
|
|
2
|
+
import { LayoutPreferenceController } from './controller/layout_preference.controller';
|
|
3
|
+
import { LayoutPreferenceService } from './service/layout_preference.service';
|
|
4
|
+
import { EntityModule } from '../meta/entity.module';
|
|
5
|
+
import { TypeOrmModule } from '@nestjs/typeorm';
|
|
6
|
+
import { LayoutPreference } from './entity/layout_preference.entity';
|
|
7
|
+
import { LayoutPreferenceRepository } from './repository/layout_preference.repository';
|
|
8
|
+
|
|
9
|
+
@Module({
|
|
10
|
+
imports: [EntityModule, TypeOrmModule.forFeature([LayoutPreference])],
|
|
11
|
+
controllers: [LayoutPreferenceController],
|
|
12
|
+
providers: [
|
|
13
|
+
{ provide: 'LayoutPreferenceService', useClass: LayoutPreferenceService },
|
|
14
|
+
LayoutPreferenceRepository,
|
|
15
|
+
],
|
|
16
|
+
})
|
|
17
|
+
export class LayoutPreferenceModule {}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Injectable } from '@nestjs/common';
|
|
2
|
+
import { InjectRepository } from '@nestjs/typeorm';
|
|
3
|
+
import { Repository } from 'typeorm';
|
|
4
|
+
import { LayoutPreference } from '../entity/layout_preference.entity';
|
|
5
|
+
|
|
6
|
+
@Injectable()
|
|
7
|
+
export class LayoutPreferenceRepository {
|
|
8
|
+
constructor(
|
|
9
|
+
@InjectRepository(LayoutPreference)
|
|
10
|
+
private readonly layoutPreferenceRepo: Repository<LayoutPreference>,
|
|
11
|
+
) {}
|
|
12
|
+
|
|
13
|
+
async findByEntityUserId(
|
|
14
|
+
entity_type: string,
|
|
15
|
+
userId: number,
|
|
16
|
+
): Promise<LayoutPreference | null> {
|
|
17
|
+
return this.layoutPreferenceRepo.findOne({
|
|
18
|
+
where: {
|
|
19
|
+
user_id: userId.toString(),
|
|
20
|
+
mapped_entity_type: entity_type,
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Injectable } from '@nestjs/common';
|
|
2
|
+
import { BaseEntity } from 'src/module/meta/entity/base-entity.entity';
|
|
3
|
+
import { EntityServiceImpl } from 'src/module/meta/service/entity-service-impl.service';
|
|
4
|
+
import { UserData } from 'src/module/user/entity/user.entity';
|
|
5
|
+
import { LayoutPreferenceRepository } from '../repository/layout_preference.repository';
|
|
6
|
+
|
|
7
|
+
@Injectable()
|
|
8
|
+
export class LayoutPreferenceService extends EntityServiceImpl {
|
|
9
|
+
constructor(private layoutPreferenceRepository: LayoutPreferenceRepository) {
|
|
10
|
+
super();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
async createEntity(entityData: BaseEntity, loggedInUser: UserData | null) {
|
|
14
|
+
const { mapped_entity_type } = entityData as any;
|
|
15
|
+
const userId = loggedInUser?.id;
|
|
16
|
+
|
|
17
|
+
if (userId === undefined) {
|
|
18
|
+
throw new Error('User ID is required to create layout preference.');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const existingLayoutPreference =
|
|
22
|
+
await this.layoutPreferenceRepository.findByEntityUserId(
|
|
23
|
+
mapped_entity_type,
|
|
24
|
+
userId,
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
console.log('existing', userId);
|
|
28
|
+
|
|
29
|
+
if (existingLayoutPreference) {
|
|
30
|
+
console.log('existing preference');
|
|
31
|
+
|
|
32
|
+
return await super.updateEntity(
|
|
33
|
+
{ ...entityData, id: existingLayoutPreference.id },
|
|
34
|
+
loggedInUser,
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return await super.createEntity(entityData, loggedInUser);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async getLayoutPreferenceByUserID(user_id, mapped_entity_type) {
|
|
42
|
+
return await this.layoutPreferenceRepository.findByEntityUserId(
|
|
43
|
+
mapped_entity_type,
|
|
44
|
+
user_id,
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -94,6 +94,7 @@ export class EntityTableService {
|
|
|
94
94
|
date: await this.listMasterService.getDropdownOptions('OPD', {}),
|
|
95
95
|
select: await this.listMasterService.getDropdownOptions('OPS', {}),
|
|
96
96
|
multiselect: await this.listMasterService.getDropdownOptions('OPM', {}),
|
|
97
|
+
year: await this.listMasterService.getDropdownOptions('OPY', {}),
|
|
97
98
|
// Add any other operations you want to include
|
|
98
99
|
};
|
|
99
100
|
entityTableDto.default_filter =
|