@steedos/service-pages 3.0.0-beta.64 → 3.0.0-beta.66
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.
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
const objectql = require('@steedos/objectql');
|
|
2
2
|
async function isSpaceUnique(spaceId, object_name, doc, name, _id){
|
|
3
|
-
const
|
|
4
|
-
filters.push(['space', '=', spaceId])
|
|
5
|
-
filters.push(['name', '=', name || doc.name])
|
|
3
|
+
const query = {space: spaceId, name: name || doc.name};
|
|
6
4
|
if(_id){
|
|
7
|
-
|
|
5
|
+
query._id = {
|
|
6
|
+
'$ne': _id
|
|
7
|
+
}
|
|
8
8
|
}
|
|
9
|
-
const
|
|
9
|
+
const datasource = objectql.getDataSource('default');
|
|
10
|
+
const adapter = datasource.adapter
|
|
11
|
+
await adapter.connect()
|
|
12
|
+
const collection = adapter.collection(object_name);
|
|
13
|
+
const count = await collection.countDocuments(query)
|
|
10
14
|
if(count > 0)
|
|
11
15
|
return false
|
|
12
16
|
return true
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos/service-pages",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.66",
|
|
4
4
|
"main": "package.service.js",
|
|
5
5
|
"scripts": {},
|
|
6
6
|
"license": "MIT",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"publishConfig": {
|
|
9
9
|
"access": "public"
|
|
10
10
|
},
|
|
11
|
-
"gitHead": "
|
|
11
|
+
"gitHead": "12ba18394ecbce4f653de5e0625ebed062c091bd",
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"clone": "^2.1.2",
|
|
14
14
|
"ejs": "^3.1.8"
|