@ruiapp/rapid-core 0.10.6 → 0.10.8
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 +14 -7
- package/package.json +1 -1
- package/src/dataAccess/entityManager.ts +15 -7
package/dist/index.js
CHANGED
|
@@ -2742,12 +2742,16 @@ async function findEntities(server, dataAccessor, options) {
|
|
|
2742
2742
|
return entities;
|
|
2743
2743
|
}
|
|
2744
2744
|
async function findEntity(server, dataAccessor, options) {
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2745
|
+
if (options.pagination) {
|
|
2746
|
+
options.pagination.limit = 1;
|
|
2747
|
+
}
|
|
2748
|
+
else {
|
|
2749
|
+
options.pagination = {
|
|
2750
|
+
offset: 0,
|
|
2748
2751
|
limit: 1,
|
|
2749
|
-
}
|
|
2750
|
-
}
|
|
2752
|
+
};
|
|
2753
|
+
}
|
|
2754
|
+
const entities = await findEntities(server, dataAccessor, options);
|
|
2751
2755
|
return lodash.first(entities);
|
|
2752
2756
|
}
|
|
2753
2757
|
async function findById(server, dataAccessor, options) {
|
|
@@ -2971,7 +2975,10 @@ async function convertEntityFiltersToRowFilters(routeContext, server, model, bas
|
|
|
2971
2975
|
}
|
|
2972
2976
|
}
|
|
2973
2977
|
}
|
|
2974
|
-
|
|
2978
|
+
let itemType;
|
|
2979
|
+
if (filter.operator === "in" || filter.operator === "notIn") {
|
|
2980
|
+
itemType = filter.itemType || (property && pgPropertyTypeColumnMap[property.type]);
|
|
2981
|
+
}
|
|
2975
2982
|
replacedFilters.push({
|
|
2976
2983
|
operator: filter.operator,
|
|
2977
2984
|
field: {
|
|
@@ -2979,7 +2986,7 @@ async function convertEntityFiltersToRowFilters(routeContext, server, model, bas
|
|
|
2979
2986
|
tableName: property && property.isBaseProperty ? baseModel.tableName : model.tableName,
|
|
2980
2987
|
},
|
|
2981
2988
|
value: filterValue,
|
|
2982
|
-
itemType
|
|
2989
|
+
itemType,
|
|
2983
2990
|
});
|
|
2984
2991
|
}
|
|
2985
2992
|
}
|
package/package.json
CHANGED
|
@@ -59,6 +59,7 @@ import { newEntityOperationError } from "~/utilities/errorUtility";
|
|
|
59
59
|
import { getNowStringWithTimezone } from "~/utilities/timeUtility";
|
|
60
60
|
import { RouteContext } from "~/core/routeContext";
|
|
61
61
|
import { validateEntity } from "./entityValidator";
|
|
62
|
+
import { pgPropertyTypeColumnMap } from "./columnTypeMapper";
|
|
62
63
|
|
|
63
64
|
export type FindOneRelationEntitiesOptions = {
|
|
64
65
|
server: IRpdServer;
|
|
@@ -361,12 +362,15 @@ async function findEntities(server: IRpdServer, dataAccessor: IRpdDataAccessor,
|
|
|
361
362
|
}
|
|
362
363
|
|
|
363
364
|
async function findEntity(server: IRpdServer, dataAccessor: IRpdDataAccessor, options: FindEntityOptions) {
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
365
|
+
if (options.pagination) {
|
|
366
|
+
options.pagination.limit = 1;
|
|
367
|
+
} else {
|
|
368
|
+
options.pagination = {
|
|
369
|
+
offset: 0,
|
|
367
370
|
limit: 1,
|
|
368
|
-
}
|
|
369
|
-
}
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
const entities = await findEntities(server, dataAccessor, options);
|
|
370
374
|
return first(entities);
|
|
371
375
|
}
|
|
372
376
|
|
|
@@ -611,7 +615,11 @@ async function convertEntityFiltersToRowFilters(
|
|
|
611
615
|
}
|
|
612
616
|
}
|
|
613
617
|
|
|
614
|
-
|
|
618
|
+
let itemType: string | undefined;
|
|
619
|
+
if (filter.operator === "in" || filter.operator === "notIn") {
|
|
620
|
+
itemType = filter.itemType || (property && pgPropertyTypeColumnMap[property.type]);
|
|
621
|
+
}
|
|
622
|
+
|
|
615
623
|
replacedFilters.push({
|
|
616
624
|
operator: filter.operator,
|
|
617
625
|
field: {
|
|
@@ -619,7 +627,7 @@ async function convertEntityFiltersToRowFilters(
|
|
|
619
627
|
tableName: property && property.isBaseProperty ? baseModel.tableName : model.tableName,
|
|
620
628
|
},
|
|
621
629
|
value: filterValue,
|
|
622
|
-
itemType
|
|
630
|
+
itemType,
|
|
623
631
|
} as any);
|
|
624
632
|
}
|
|
625
633
|
}
|