@nocobase/database 1.6.0-alpha.10 → 1.6.0-alpha.11
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.
|
@@ -38,7 +38,7 @@ const _ToManyInterface = class _ToManyInterface extends import_base_interface.Ba
|
|
|
38
38
|
}
|
|
39
39
|
str = `${str}`.trim();
|
|
40
40
|
const items = str.split(",");
|
|
41
|
-
const { filterKey, targetCollection, transaction } = ctx;
|
|
41
|
+
const { filterKey, targetCollection, transaction, field } = ctx;
|
|
42
42
|
const targetInstances = await targetCollection.repository.find({
|
|
43
43
|
filter: {
|
|
44
44
|
[filterKey]: items
|
|
@@ -51,7 +51,17 @@ const _ToManyInterface = class _ToManyInterface extends import_base_interface.Ba
|
|
|
51
51
|
}
|
|
52
52
|
});
|
|
53
53
|
const primaryKeyAttribute = targetCollection.model.primaryKeyAttribute;
|
|
54
|
-
|
|
54
|
+
const targetKey = field.options.targetKey;
|
|
55
|
+
const values = targetInstances.map((targetInstance) => {
|
|
56
|
+
const result = {
|
|
57
|
+
[targetKey]: targetInstance[targetKey]
|
|
58
|
+
};
|
|
59
|
+
if (targetKey !== primaryKeyAttribute) {
|
|
60
|
+
result[primaryKeyAttribute] = targetInstance[primaryKeyAttribute];
|
|
61
|
+
}
|
|
62
|
+
return result;
|
|
63
|
+
});
|
|
64
|
+
return values;
|
|
55
65
|
}
|
|
56
66
|
};
|
|
57
67
|
__name(_ToManyInterface, "ToManyInterface");
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/database",
|
|
3
|
-
"version": "1.6.0-alpha.
|
|
3
|
+
"version": "1.6.0-alpha.11",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
7
7
|
"license": "AGPL-3.0",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@nocobase/logger": "1.6.0-alpha.
|
|
10
|
-
"@nocobase/utils": "1.6.0-alpha.
|
|
9
|
+
"@nocobase/logger": "1.6.0-alpha.11",
|
|
10
|
+
"@nocobase/utils": "1.6.0-alpha.11",
|
|
11
11
|
"async-mutex": "^0.3.2",
|
|
12
12
|
"chalk": "^4.1.1",
|
|
13
13
|
"cron-parser": "4.4.0",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"url": "git+https://github.com/nocobase/nocobase.git",
|
|
39
39
|
"directory": "packages/database"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "2a07f8a9af90b3ce09229cae72a485c14df2361b"
|
|
42
42
|
}
|