Skip to content

Metadata Structure

Tomáš Livora edited this page Aug 19, 2017 · 38 revisions

CollectionMetadataFacade

{
   "name":"Collection",
   "code":"Code",
   "icon":"fa-user",
   "color": "#fafafa",
   "documentCount": 123,
   "attributes":[
      {
         "name":"attribute1",
         "full-name":"attribute1",
         "constraints":[ "isNumber", "lessThan:3"],
         "count":2
      },
      {
         "name":"child",
         "full-name":"attribute1.child",
         "constraints":[],
         "count":1
      }
   ],
   "last":   ISODate("2017-03-24T17:04:10.989   Z"),
   "recently":[],
   "permissions":{
      "users":[
          { 
         "name": "user1",
         "roles": ["manage", "read"]
          },
          { 
         "name": "user2",
         "roles": ["write", "read"]
          }
        ]
      },
      "groups":[
          { 
         "name": "group1",
         "roles": ["manage", "read"]
          },
          { 
         "name": "group2",
         "roles": ["write", "read"]
          }
        ]
      }
   }
}

name is name of collection given by user,

code is generated, but can be edited,

icon icon of collection,

color color of collection,

documentCount number of documents in collection,

attributes is an array of attribute documents,

full-name is name with all its parents,

constraints is array of strings with constraints configurations,

count is a number of documents in collection that contain the attribute,

last is the time when collection was used for the last time,

recently is an array of IDs of documents in collection, the first is the one most recently used.

permissions is structure of user and group permisisions of collectioon

ConfigurationFacade

There are three collections in the system database used by ConfigurationFacade to store configuration:

  • _config_user
  • _config_project
  • _config_organization

Each of these collections has the following structure:

{
  "name": "organizationId/projectId/userEmail",
  "configs": [
               {
                "key" : "config1",
                "value" : "value1",
                "description" : "some description...",
                "restricted" : true
               },
               {
                "key" : "config2",
                "value" : "value2",
                "description" : "some other description...",
                "restricted" : false
               }
             ]
}

The only difference is in the name field which is organizationId/projectId for project configuration and just organizationId for organization configuration.

DocumentMetadataFacade

    {
   	"_meta-create-date" : "date",
   	"_meta-update-date" : "date",
   	"_meta-creator-user" : "user_name",
   	"_meta-update-user" : "user_name",
   	… (rest of the document) …
   }

_meta-create-date is date of creation document,

_meta-update-date is date of last update of document,

_meta-creator-user is user who create the document,

_meta-update-user is user who perform last update on document,

VersionFacade

{
    "_id":{"_id" : "idOfDocument", "_meta-version" : 3},
   // rest of document is same as in DocumentMetadataFacade
}

LinkingFacade

Linking type collection

{
 "project": "projectId",
 "fromCollection": "collection1",
 "toCollection" : "collection2",
 "role" : "role"
}

fromCollection is name of first collection

toCollection is name of second collection

project is the name of project

role is name of role which specify link between collections

Linking instances collection

{
   "type-id": "typeId",
   "from-id" : "id1",
   "to-id" : "id2",
   "attributes" : {
         "attr1" : "value1",
         ....
    }
}

type-id is the id from linking type collection

fromId is the id of first document,

toId is the id of second document,

attributes are some custom attributes of link instance

ProjectFacade

{
   "project-id" : "projId",
   "organization-id" : "orgId",
   "project-name" : "name",
   "_meta-icon": "icon",
   "_meta-color" : "color",
}

project-id is unique id of the project,

organization-id is id of the organization,

project-name is unique name of the project,

_meta-icon is icon of the project,

_meta-color is default color of the project,

OrganizationFacade

{ 
   "organization-id" : "orgId", 
   "organization-name" : "name", 
   "organization-info-data" : {
      "attribute1": "value1",
      "attribute2": "value2",
      ...
   }, 
   "_meta-icon" : "icon", 
   "_meta-color" : "color",
} 

organization-id is unique id of the organization,

organization-name is unique name of the organization,

organization-info-data is a list of additional organization pieces of information,

_meta-icon is an icon of the organization,

_meta-color is default color of the organization,

UserGroupFacade

UserGroup

{
	"organization-id": "orgId",
	"users": [{
		"user": "user1",
		"groups": ["group1", "group2", "group3 "]
	}, {
		"user": "user2",
		"groups": ["group3", "group2", "group4 "]
	}]
}

Group

{
   "organization-id" : "orgId",
   "groups": ["group1", "group2", "group3"] 
}

SecurityFacade

Organisation roles

{
   "organization-id":"project1",
   "roles":{
      "manage":{
         "users": ["user1", "user2"],
         "groups": ["group1"]
      },
      "write":{
         "users": [],
         "groups": ["group2"]
      }
   },
}

Project roles

{
   "project-id":"project1",
   "source-type":"project",
   "roles":{
      "manage":{
         "users": ["user1", "user2"],
         "groups": ["group1"]
      },
      "write":{
         "users": [],
         "groups": ["group2"]
      }
   },
}

View roles

{
   "project-id":"project1",
   "source-id":"my view",
   "source-type":"view",
   "roles":{
      "manage":{
         "users": ["user1", "user2"],
         "groups": ["group1"]
      },
      "read":{
         "users": [],
         "groups": ["group2"]
      },
      "clone":{
         "users": [],
         "groups": []
      }
   },
}

source-id is name of collection, or id of view, or id of project,

source-type is collection, view or project,

project-id is id of project where the collection/view belongs.

Clone this wiki locally