@steedos/standard-object-database 2.3.1 → 2.3.2-beta.2

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.
@@ -3,11 +3,14 @@ const objectql = require('@steedos/objectql');
3
3
  const auth = require('@steedos/auth');
4
4
  const InternalData = require('@steedos/standard-objects').internalData;
5
5
  const util = require('@steedos/standard-objects').util
6
- function check(objectName, profiles, id){
6
+ function check(spaceId, objectName, profiles, id){
7
7
  let query = {
8
8
  object_name: objectName,
9
9
  profiles: {$in: profiles}
10
10
  }
11
+ if(spaceId){
12
+ query.space = spaceId;
13
+ }
11
14
  if(id){
12
15
  query._id = {$ne: id}
13
16
  }
@@ -38,7 +41,7 @@ const getInternalLatouts = async function(sourceLayouts, filters){
38
41
  module.exports = {
39
42
  beforeInsert: async function(){
40
43
  let doc = this.doc
41
- check(doc.object_name, doc.profiles);
44
+ check(this.spaceId, doc.object_name, doc.profiles);
42
45
 
43
46
  await util.checkAPIName(this.object_name, 'name', this.doc.name, undefined, [['is_system','!=', true], ['object_name','=', doc.object_name]]);
44
47
 
@@ -54,7 +57,7 @@ module.exports = {
54
57
  let doc = this.doc
55
58
  let id = this.id
56
59
  let record = Creator.getCollection("object_layouts").findOne({_id: id}) || {};
57
- check(doc.object_name || record.object_name, doc.profiles || record.profiles, id);
60
+ check(this.spaceId, doc.object_name || record.object_name, doc.profiles || record.profiles, id);
58
61
  if (_.has(doc, 'name')) {
59
62
  await util.checkAPIName(this.object_name, 'name', doc.name, this.id, [['is_system','!=', true], ['object_name','=', doc.object_name || record.object_name]]);
60
63
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos/standard-object-database",
3
- "version": "2.3.1",
3
+ "version": "2.3.2-beta.2",
4
4
  "main": "package.service.js",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -12,5 +12,5 @@
12
12
  "description": "steedos package",
13
13
  "repository": {},
14
14
  "license": "MIT",
15
- "gitHead": "f8938e298cec11b2f91172e0d3506079daa7d670"
15
+ "gitHead": "2e469778c682ec784fbfb93f5e83d2f5f9671ea5"
16
16
  }