@ruiapp/rapid-core 0.1.24 → 0.1.26

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/index.js CHANGED
@@ -1951,6 +1951,10 @@ async function replaceFiltersWithFiltersOperator(server, model, filters) {
1951
1951
  }
1952
1952
  }
1953
1953
  else {
1954
+ const property = lodash.find(model.properties, (property) => property.code === filter.field);
1955
+ if (property) {
1956
+ filter.field = property.columnName || property.code;
1957
+ }
1954
1958
  replacedFilters.push(filter);
1955
1959
  }
1956
1960
  }
@@ -2171,7 +2175,7 @@ async function updateEntityById(server, dataAccessor, options, plugin) {
2171
2175
  if (Object.keys(row).length) {
2172
2176
  updatedRow = await dataAccessor.updateById(id, row);
2173
2177
  }
2174
- let updatedEntity = mapDbRowToEntity(model, updatedRow, false);
2178
+ let updatedEntity = mapDbRowToEntity(model, updatedRow, true);
2175
2179
  updatedEntity = Object.assign({}, entity, updatedEntity);
2176
2180
  // save many-relation properties
2177
2181
  for (const property of manyRelationPropertiesToUpdate) {
package/dist/types.d.ts CHANGED
@@ -278,6 +278,7 @@ export type EntityFilterUnaryOperators = "null" | "notNull";
278
278
  export type EntityFilterExistenceOperators = "exists" | "notExists";
279
279
  export type EntityFilterOperators = EntityFilterRelationalOperators | EntityFilterSetOperators | EntityFilterLogicalOperators | EntityFilterUnaryOperators | EntityFilterExistenceOperators;
280
280
  export type EntityFilterOptions = FindEntityRelationalFilterOptions | FindEntitySetFilterOptions | FindEntityLogicalFilterOptions | FindEntityUnaryFilterOptions | FindEntityExistenceFilterOptions;
281
+ export type EntityNonRelationPropertyFilterOptions = FindEntityRelationalFilterOptions | FindEntitySetFilterOptions | FindEntityUnaryFilterOptions;
281
282
  export interface FindEntityOptions {
282
283
  filters?: EntityFilterOptions[];
283
284
  orderBy?: FindEntityOrderByOptions[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ruiapp/rapid-core",
3
- "version": "0.1.24",
3
+ "version": "0.1.26",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -5,6 +5,7 @@ import {
5
5
  CreateEntityOptions,
6
6
  EntityFilterOperators,
7
7
  EntityFilterOptions,
8
+ EntityNonRelationPropertyFilterOptions,
8
9
  FindEntityOptions,
9
10
  FindEntityOrderByOptions,
10
11
  IRpdDataAccessor,
@@ -335,6 +336,13 @@ async function replaceFiltersWithFiltersOperator(
335
336
  });
336
337
  }
337
338
  } else {
339
+ const property: RpdDataModelProperty = find(
340
+ model.properties,
341
+ (property: RpdDataModelProperty) => property.code === (filter as EntityNonRelationPropertyFilterOptions).field,
342
+ );
343
+ if (property) {
344
+ (filter as EntityNonRelationPropertyFilterOptions).field = property.columnName || property.code;
345
+ }
338
346
  replacedFilters.push(filter);
339
347
  }
340
348
  }
@@ -602,7 +610,7 @@ async function updateEntityById(
602
610
  if (Object.keys(row).length) {
603
611
  updatedRow = await dataAccessor.updateById(id, row);
604
612
  }
605
- let updatedEntity = mapDbRowToEntity(model, updatedRow, false);
613
+ let updatedEntity = mapDbRowToEntity(model, updatedRow, true);
606
614
  updatedEntity = Object.assign({}, entity, updatedEntity);
607
615
 
608
616
  // save many-relation properties
package/src/types.ts CHANGED
@@ -378,6 +378,11 @@ export type EntityFilterOptions =
378
378
  | FindEntityUnaryFilterOptions
379
379
  | FindEntityExistenceFilterOptions;
380
380
 
381
+ export type EntityNonRelationPropertyFilterOptions =
382
+ | FindEntityRelationalFilterOptions
383
+ | FindEntitySetFilterOptions
384
+ | FindEntityUnaryFilterOptions;
385
+
381
386
  export interface FindEntityOptions {
382
387
  filters?: EntityFilterOptions[];
383
388
  orderBy?: FindEntityOrderByOptions[];