rez_core 2.1.29 → 2.1.31

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rez_core",
3
- "version": "2.1.29",
3
+ "version": "2.1.31",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -25,7 +25,6 @@ export class FilterService {
25
25
  column: string | undefined,
26
26
  whereClauses: { query: string; params: Record<string, any> }[],
27
27
  ) {
28
- console.log('GTETABCOUNTS', tableName, column, whereClauses);
29
28
  if (!column) return [];
30
29
 
31
30
  let whereSQL = '';
@@ -96,8 +95,6 @@ export class FilterService {
96
95
  'LIST',
97
96
  );
98
97
 
99
- console.log(getTableMeta, 'GETTABLEMETA');
100
-
101
98
  if (!getTableMeta) {
102
99
  throw new BadRequestException(
103
100
  `Table meta not found for entity_type: ${entity_type}`,
@@ -110,7 +107,6 @@ export class FilterService {
110
107
  true,
111
108
  );
112
109
 
113
- console.log(getTableColumnMeta, 'GETTABLECOLUMNMETA');
114
110
  // const attributeMeta =
115
111
  // await this.attributeMasterService.findAttributesByMappedEntityType(
116
112
  // entity_type,
@@ -123,7 +119,6 @@ export class FilterService {
123
119
  {} as Record<string, any>,
124
120
  );
125
121
 
126
- console.log(attributeMetaMap, 'ATTRIBUTEMETAMAP');
127
122
  // Get and parse filters
128
123
  const savedFilters = await this.getSavedFilters(savedFilterCode);
129
124
  const baseFilters = [
@@ -133,7 +128,7 @@ export class FilterService {
133
128
  ];
134
129
 
135
130
  const baseWhere = this.buildWhereClauses(baseFilters, attributeMetaMap);
136
- console.log(baseWhere, 'BASEWHERE', level_type, level_id);
131
+
137
132
  if (level_type && level_id) {
138
133
  baseWhere.push({
139
134
  query: 'e.level_type = :level_type AND e.level_id = :level_id',
@@ -144,9 +139,7 @@ export class FilterService {
144
139
  });
145
140
  }
146
141
 
147
- console.log('OUSTSIDE SKIP');
148
142
  if (this.skipLevelFilterEntities.includes(entity_type)) {
149
- console.log('INSIDE SKIP');
150
143
  baseWhere.push({
151
144
  query: 'e.appcode = :appcode',
152
145
  params: { appcode },
@@ -160,15 +153,12 @@ export class FilterService {
160
153
  [user_id, entity_type],
161
154
  );
162
155
 
163
- console.log('LAYOUTPREFERNECE', layoutPreference);
164
-
165
156
  // Extract layout preference
166
157
  const layout = layoutPreference?.[0]?.layout_json?.quick_tab || {};
167
158
  let showList = layout?.show_list?.map((val) => val.toLowerCase()) || [];
168
159
 
169
160
  let allTabs;
170
161
  if (layout.attribute) {
171
- console.log('IN LAYOUT');
172
162
  allTabs = await this.gettab_value_counts(
173
163
  getTableMeta.data_source,
174
164
  layout.attribute,
@@ -220,8 +210,6 @@ export class FilterService {
220
210
  filteredTabs = allTabs;
221
211
  }
222
212
 
223
- console.log(allTabs, 'ALLTABSE');
224
-
225
213
  const dataWhere = [...baseWhere];
226
214
 
227
215
  if (tabs?.columnName && tabs?.value) {
@@ -255,6 +243,7 @@ export class FilterService {
255
243
  },
256
244
  tabAttrMeta,
257
245
  );
246
+
258
247
  if (tabCondition) {
259
248
  dataWhere.push(tabCondition);
260
249
  }
@@ -272,21 +261,33 @@ export class FilterService {
272
261
  qb.andWhere(clause.query, clause.params);
273
262
  });
274
263
 
275
- if (Array.isArray(sortby)) {
276
- // Optional sorting
277
- sortby.forEach(({ sortColum, sortType }) => {
278
- qb.addOrderBy(
279
- `e.${sortColum}`,
280
- sortType.toUpperCase() === 'DSC' ? 'DESC' : 'ASC',
264
+ // if (Array.isArray(sortby)) {
265
+ // // Optional sorting
266
+ // sortby.forEach(({ sortColum, sortType }) => {
267
+ // qb.addOrderBy(
268
+ // `e.${sortColum}`,
269
+ // sortType.toUpperCase() === 'DSC' ? 'DESC' : 'ASC',
270
+ // );
271
+ // });
272
+ // }
273
+
274
+ if (layoutPreference && layoutPreference[0]?.layout_json?.sorting) {
275
+ if (Array.isArray(layoutPreference[0]?.layout_json?.sorting?.tabs)) {
276
+ let preferenceTabArray =
277
+ layoutPreference[0]?.layout_json?.sorting?.tabs;
278
+ let tabFilter = preferenceTabArray.find(
279
+ (tabData) => tabData.tab_name === tabs?.value,
281
280
  );
282
- });
283
- }
284
281
 
285
- if (
286
- layoutPreference &&
287
- layoutPreference[0]?.layout_json?.sorting?.sortby?.length > 0
288
- ) {
289
- if (Array.isArray(layoutPreference[0]?.layout_json?.sorting?.sortby)) {
282
+ tabFilter?.sortby.forEach(({ column, order }) => {
283
+ qb.addOrderBy(
284
+ `e.${column}`,
285
+ order?.toUpperCase() === 'DSC' ? 'DESC' : 'ASC',
286
+ );
287
+ });
288
+ } else if (
289
+ Array.isArray(layoutPreference[0]?.layout_json?.sorting?.sortby)
290
+ ) {
290
291
  // Optional sorting
291
292
  layoutPreference[0]?.layout_json?.sorting?.sortby?.forEach(
292
293
  ({ column, order }) => {
@@ -62,6 +62,7 @@ export class EntityController {
62
62
  }
63
63
 
64
64
  @Post('create')
65
+ @HttpCode(200)
65
66
  async create(
66
67
  @Body() entityData: BaseEntity,
67
68
  @Query('entity_type') entityType: string,
@@ -98,6 +99,7 @@ export class EntityController {
98
99
  }
99
100
 
100
101
  @Post('update/:id')
102
+ @HttpCode(200)
101
103
  async update(
102
104
  @Param('id') id: number,
103
105
  @Body() entityData: BaseEntity,