From c8f37bb4960271d055aab47553def6237c522cbc Mon Sep 17 00:00:00 2001 From: Andrey Platov <87076238+aplatoff@users.noreply.github.com> Date: Sun, 8 Aug 2021 10:43:11 +0200 Subject: [PATCH] Fixes #10 (#11) Signed-off-by: Andrey Platov --- dev/storage/src/model.tx.json | 384 +++++++++++++--------- models/contact/src/index.ts | 7 + models/contact/src/plugin.ts | 5 +- models/core/src/security.ts | 4 +- models/demo/package.json | 3 +- models/demo/src/index.ts | 26 ++ packages/core/src/__tests__/memdb.test.ts | 2 +- packages/core/src/classes.ts | 4 +- 8 files changed, 276 insertions(+), 159 deletions(-) diff --git a/dev/storage/src/model.tx.json b/dev/storage/src/model.tx.json index c376cbb84f..ab695b2783 100644 --- a/dev/storage/src/model.tx.json +++ b/dev/storage/src/model.tx.json @@ -1,25 +1,25 @@ [ { - "_id": "610ef7a8d5ad6686cbe9225a", + "_id": "610f986c458521557bb213fe", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", "objectId": "core:class:Obj", "objectClass": "core:class:Class", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856635, + "modifiedOn": 1628412012608, "modifiedBy": "core:account:System", "attributes": { "kind": 0 } }, { - "_id": "610ef7a8d5ad6686cbe9225b", + "_id": "610f986c458521557bb213ff", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", "objectId": "core:class:Doc", "objectClass": "core:class:Class", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856635, + "modifiedOn": 1628412012608, "modifiedBy": "core:account:System", "attributes": { "kind": 0, @@ -27,13 +27,13 @@ } }, { - "_id": "610ef7a8d5ad6686cbe9225c", + "_id": "610f986c458521557bb21400", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", "objectId": "core:class:Type", "objectClass": "core:class:Class", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856635, + "modifiedOn": 1628412012608, "modifiedBy": "core:account:System", "attributes": { "kind": 0, @@ -41,13 +41,13 @@ } }, { - "_id": "610ef7a8d5ad6686cbe9225d", + "_id": "610f986c458521557bb21401", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", "objectId": "core:class:TypeString", "objectClass": "core:class:Class", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856635, + "modifiedOn": 1628412012608, "modifiedBy": "core:account:System", "attributes": { "kind": 0, @@ -55,13 +55,13 @@ } }, { - "_id": "610ef7a8d5ad6686cbe9225e", + "_id": "610f986c458521557bb21402", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", "objectId": "core:class:Attribute", "objectClass": "core:class:Class", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856635, + "modifiedOn": 1628412012608, "modifiedBy": "core:account:System", "attributes": { "kind": 0, @@ -69,13 +69,13 @@ } }, { - "_id": "610ef7a8d5ad6686cbe9225f", + "_id": "610f986c458521557bb21403", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", "objectId": "core:class:Account", "objectClass": "core:class:Class", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856635, + "modifiedOn": 1628412012608, "modifiedBy": "core:account:System", "attributes": { "domain": "model", @@ -84,13 +84,13 @@ } }, { - "_id": "610ef7a8d5ad6686cbe92260", + "_id": "610f986c458521557bb21404", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", "objectId": "core:class:Space", "objectClass": "core:class:Class", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856635, + "modifiedOn": 1628412012608, "modifiedBy": "core:account:System", "attributes": { "domain": "model", @@ -99,13 +99,13 @@ } }, { - "_id": "610ef7a8d5ad6686cbe92261", + "_id": "610f986c458521557bb21405", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", "objectId": "core:class:Tx", "objectClass": "core:class:Class", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856635, + "modifiedOn": 1628412012608, "modifiedBy": "core:account:System", "attributes": { "domain": "tx", @@ -114,13 +114,13 @@ } }, { - "_id": "610ef7a8d5ad6686cbe92262", + "_id": "610f986c458521557bb21406", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", "objectId": "core:class:TxCUD", "objectClass": "core:class:Class", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856635, + "modifiedOn": 1628412012608, "modifiedBy": "core:account:System", "attributes": { "kind": 0, @@ -128,13 +128,13 @@ } }, { - "_id": "610ef7a8d5ad6686cbe92263", + "_id": "610f986c458521557bb21407", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", "objectId": "core:class:TxUpdateDoc", "objectClass": "core:class:Class", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856635, + "modifiedOn": 1628412012608, "modifiedBy": "core:account:System", "attributes": { "kind": 0, @@ -142,13 +142,13 @@ } }, { - "_id": "610ef7a8d5ad6686cbe92264", + "_id": "610f986c458521557bb21408", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", "objectId": "core:class:TxMixin", "objectClass": "core:class:Class", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856635, + "modifiedOn": 1628412012608, "modifiedBy": "core:account:System", "attributes": { "kind": 0, @@ -156,13 +156,13 @@ } }, { - "_id": "610ef7a8d5ad6686cbe92265", + "_id": "610f986c458521557bb21409", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", "objectId": "core:class:TxCreateDoc", "objectClass": "core:class:Class", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856635, + "modifiedOn": 1628412012608, "modifiedBy": "core:account:System", "attributes": { "kind": 0, @@ -170,13 +170,13 @@ } }, { - "_id": "610ef7a8d5ad6686cbe92266", + "_id": "610f986c458521557bb2140a", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", "objectId": "core:class:Class", "objectClass": "core:class:Class", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856635, + "modifiedOn": 1628412012608, "modifiedBy": "core:account:System", "attributes": { "domain": "model", @@ -185,13 +185,13 @@ } }, { - "_id": "610ef7a8d5ad6686cbe92267", + "_id": "610f986c458521557bb2140b", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", "objectId": "core:class:Mixin", "objectClass": "core:class:Class", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856635, + "modifiedOn": 1628412012608, "modifiedBy": "core:account:System", "attributes": { "kind": 0, @@ -199,13 +199,13 @@ } }, { - "_id": "610ef7a8d5ad6686cbe92268", + "_id": "610f986c458521557bb2140c", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", "objectId": "view:class:Viewlet", "objectClass": "core:class:Class", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856635, + "modifiedOn": 1628412012608, "modifiedBy": "core:account:System", "attributes": { "domain": "model", @@ -214,13 +214,13 @@ } }, { - "_id": "610ef7a8d5ad6686cbe92269", + "_id": "610f986c458521557bb2140d", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", "objectId": "view:class:ViewletDescriptor", "objectClass": "core:class:Class", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856635, + "modifiedOn": 1628412012608, "modifiedBy": "core:account:System", "attributes": { "domain": "model", @@ -229,13 +229,13 @@ } }, { - "_id": "610ef7a8d5ad6686cbe9226a", + "_id": "610f986c458521557bb2140e", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", "objectId": "view:mixin:AttributePresenter", "objectClass": "core:class:Class", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856635, + "modifiedOn": 1628412012608, "modifiedBy": "core:account:System", "attributes": { "kind": 0, @@ -243,13 +243,13 @@ } }, { - "_id": "610ef7a8d5ad6686cbe9226b", + "_id": "610f986c458521557bb2140f", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", "objectId": "view:mixin:AttributeEditor", "objectClass": "core:class:Class", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856635, + "modifiedOn": 1628412012608, "modifiedBy": "core:account:System", "attributes": { "kind": 0, @@ -257,11 +257,11 @@ } }, { - "_id": "610ef7a8d5ad6686cbe9226c", + "_id": "610f986c458521557bb21410", "_class": "core:class:TxMixin", "space": "core:space:Tx", "modifiedBy": "core:account:System", - "modifiedOn": 1628370856635, + "modifiedOn": 1628412012608, "objectId": "core:class:TypeString", "objectClass": "core:class:Class", "objectSpace": "core:space:Model", @@ -271,11 +271,11 @@ } }, { - "_id": "610ef7a8d5ad6686cbe9226d", + "_id": "610f986c458521557bb21411", "_class": "core:class:TxMixin", "space": "core:space:Tx", "modifiedBy": "core:account:System", - "modifiedOn": 1628370856635, + "modifiedOn": 1628412012608, "objectId": "core:class:TypeString", "objectClass": "core:class:Class", "objectSpace": "core:space:Model", @@ -285,13 +285,13 @@ } }, { - "_id": "610ef7a8d5ad6686cbe9226e", + "_id": "610f986c458521557bb21412", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", "objectId": "view:viewlet:Table", "objectClass": "view:class:ViewletDescriptor", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856635, + "modifiedOn": 1628412012608, "modifiedBy": "core:account:System", "attributes": { "label": "Table", @@ -300,13 +300,13 @@ } }, { - "_id": "610ef7a8d5ad6686cbe9226f", + "_id": "610f986c458521557bb21413", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", "objectId": "workbench:mixin:SpaceView", "objectClass": "core:class:Class", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856635, + "modifiedOn": 1628412012608, "modifiedBy": "core:account:System", "attributes": { "kind": 0, @@ -314,13 +314,13 @@ } }, { - "_id": "610ef7a8d5ad6686cbe92270", + "_id": "610f986c458521557bb21414", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", "objectId": "workbench:class:Application", "objectClass": "core:class:Class", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856635, + "modifiedOn": 1628412012608, "modifiedBy": "core:account:System", "attributes": { "domain": "model", @@ -329,13 +329,13 @@ } }, { - "_id": "610ef7a8d5ad6686cbe92271", + "_id": "610f986c458521557bb21415", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", "objectId": "contact:class:Contact", "objectClass": "core:class:Class", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856635, + "modifiedOn": 1628412012608, "modifiedBy": "core:account:System", "attributes": { "domain": "contact", @@ -344,13 +344,13 @@ } }, { - "_id": "610ef7a8d5ad6686cbe92272", + "_id": "610f986c458521557bb21416", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", "objectId": "contact:class:Person", "objectClass": "core:class:Class", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856635, + "modifiedOn": 1628412012608, "modifiedBy": "core:account:System", "attributes": { "kind": 0, @@ -359,12 +359,12 @@ } }, { - "_id": "610ef7a8d5ad6686cbe92273", - "objectId": "610ef7a8d5ad6686cbe92274", + "_id": "610f986c458521557bb21417", + "objectId": "610f986c458521557bb21418", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", "modifiedBy": "core:account:System", - "modifiedOn": 1628370856477, + "modifiedOn": 1628412012451, "objectSpace": "core:space:Model", "objectClass": "core:class:Attribute", "attributes": { @@ -377,12 +377,12 @@ } }, { - "_id": "610ef7a8d5ad6686cbe92275", - "objectId": "610ef7a8d5ad6686cbe92276", + "_id": "610f986c458521557bb21419", + "objectId": "610f986c458521557bb2141a", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", "modifiedBy": "core:account:System", - "modifiedOn": 1628370856477, + "modifiedOn": 1628412012451, "objectSpace": "core:space:Model", "objectClass": "core:class:Attribute", "attributes": { @@ -395,12 +395,12 @@ } }, { - "_id": "610ef7a8d5ad6686cbe92277", - "objectId": "610ef7a8d5ad6686cbe92278", + "_id": "610f986c458521557bb2141b", + "objectId": "610f986c458521557bb2141c", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", "modifiedBy": "core:account:System", - "modifiedOn": 1628370856477, + "modifiedOn": 1628412012451, "objectSpace": "core:space:Model", "objectClass": "core:class:Attribute", "attributes": { @@ -413,12 +413,12 @@ } }, { - "_id": "610ef7a8d5ad6686cbe92279", - "objectId": "610ef7a8d5ad6686cbe9227a", + "_id": "610f986c458521557bb2141d", + "objectId": "610f986c458521557bb2141e", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", "modifiedBy": "core:account:System", - "modifiedOn": 1628370856477, + "modifiedOn": 1628412012451, "objectSpace": "core:space:Model", "objectClass": "core:class:Attribute", "attributes": { @@ -431,12 +431,12 @@ } }, { - "_id": "610ef7a8d5ad6686cbe9227b", - "objectId": "610ef7a8d5ad6686cbe9227c", + "_id": "610f986c458521557bb2141f", + "objectId": "610f986c458521557bb21420", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", "modifiedBy": "core:account:System", - "modifiedOn": 1628370856477, + "modifiedOn": 1628412012451, "objectSpace": "core:space:Model", "objectClass": "core:class:Attribute", "attributes": { @@ -449,13 +449,13 @@ } }, { - "_id": "610ef7a8d5ad6686cbe9227d", + "_id": "610f986c458521557bb21421", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", "objectId": "contact:class:Employee", "objectClass": "core:class:Class", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856635, + "modifiedOn": 1628412012609, "modifiedBy": "core:account:System", "attributes": { "kind": 0, @@ -463,13 +463,13 @@ } }, { - "_id": "610ef7a8d5ad6686cbe9227e", + "_id": "610f986c458521557bb21422", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", "objectId": "contact:class:Organization", "objectClass": "core:class:Class", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856635, + "modifiedOn": 1628412012609, "modifiedBy": "core:account:System", "attributes": { "kind": 0, @@ -477,11 +477,27 @@ } }, { - "_id": "610ef7a8d5ad6686cbe9227f", + "_id": "610f986c458521557bb21423", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "contact:space:Employee", + "objectClass": "core:class:Space", + "objectSpace": "core:space:Model", + "modifiedOn": 1628412012609, + "modifiedBy": "core:account:System", + "attributes": { + "name": "Employees", + "description": "Employees", + "private": false, + "members": [] + } + }, + { + "_id": "610f986c458521557bb21424", "_class": "core:class:TxMixin", "space": "core:space:Tx", "modifiedBy": "core:account:System", - "modifiedOn": 1628370856635, + "modifiedOn": 1628412012609, "objectId": "contact:class:Person", "objectClass": "core:class:Class", "objectSpace": "core:space:Model", @@ -491,13 +507,13 @@ } }, { - "_id": "610ef7a8d5ad6686cbe92280", + "_id": "610f986c458521557bb21425", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", "objectId": "chunter:class:Backlink", "objectClass": "core:class:Class", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856635, + "modifiedOn": 1628412012609, "modifiedBy": "core:account:System", "attributes": { "domain": "backlinks", @@ -506,13 +522,13 @@ } }, { - "_id": "610ef7a8d5ad6686cbe92281", + "_id": "610f986c458521557bb21426", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", "objectId": "chunter:class:Message", "objectClass": "core:class:Class", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856635, + "modifiedOn": 1628412012609, "modifiedBy": "core:account:System", "attributes": { "domain": "chunter", @@ -521,13 +537,13 @@ } }, { - "_id": "610ef7a8d5ad6686cbe92282", + "_id": "610f986c458521557bb21427", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", "objectId": "chunter:class:Channel", "objectClass": "core:class:Class", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856635, + "modifiedOn": 1628412012609, "modifiedBy": "core:account:System", "attributes": { "kind": 0, @@ -537,11 +553,11 @@ } }, { - "_id": "610ef7a8d5ad6686cbe92283", + "_id": "610f986c458521557bb21428", "_class": "core:class:TxMixin", "space": "core:space:Tx", "modifiedBy": "core:account:System", - "modifiedOn": 1628370856635, + "modifiedOn": 1628412012609, "objectId": "chunter:class:Channel", "objectClass": "core:class:Class", "objectSpace": "core:space:Model", @@ -553,13 +569,13 @@ } }, { - "_id": "610ef7a8d5ad6686cbe92284", + "_id": "610f986c458521557bb21429", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", "objectId": "chunter:viewlet:Chat", "objectClass": "view:class:ViewletDescriptor", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856635, + "modifiedOn": 1628412012609, "modifiedBy": "core:account:System", "attributes": { "label": "Chat", @@ -568,13 +584,13 @@ } }, { - "_id": "610ef7a8d5ad6686cbe92285", + "_id": "610f986c458521557bb2142a", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", - "objectId": "610ef7a8d5ad6686cbe92286", + "objectId": "610f986c458521557bb2142b", "objectClass": "view:class:Viewlet", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856635, + "modifiedOn": 1628412012609, "modifiedBy": "core:account:System", "attributes": { "attachTo": "chunter:class:Message", @@ -584,13 +600,13 @@ } }, { - "_id": "610ef7a8d5ad6686cbe92287", + "_id": "610f986c458521557bb2142c", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", - "objectId": "610ef7a8d5ad6686cbe92288", + "objectId": "610f986c458521557bb2142d", "objectClass": "workbench:class:Application", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856635, + "modifiedOn": 1628412012609, "modifiedBy": "core:account:System", "attributes": { "label": "chunter:string:ApplicationLabelChunter", @@ -608,13 +624,13 @@ } }, { - "_id": "610ef7a8d5ad6686cbe92289", + "_id": "610f986c458521557bb2142e", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", - "objectId": "610ef7a8d5ad6686cbe9228a", + "objectId": "610f986c458521557bb2142f", "objectClass": "chunter:class:Channel", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856635, + "modifiedOn": 1628412012609, "modifiedBy": "core:account:System", "attributes": { "name": "general", @@ -624,13 +640,13 @@ } }, { - "_id": "610ef7a8d5ad6686cbe9228b", + "_id": "610f986c458521557bb21430", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", - "objectId": "610ef7a8d5ad6686cbe9228c", + "objectId": "610f986c458521557bb21431", "objectClass": "chunter:class:Channel", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856635, + "modifiedOn": 1628412012609, "modifiedBy": "core:account:System", "attributes": { "name": "random", @@ -640,13 +656,13 @@ } }, { - "_id": "610ef7a8d5ad6686cbe9228d", + "_id": "610f986c458521557bb21432", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", "objectId": "task:class:Task", "objectClass": "core:class:Class", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856636, + "modifiedOn": 1628412012609, "modifiedBy": "core:account:System", "attributes": { "kind": 0, @@ -654,12 +670,12 @@ } }, { - "_id": "610ef7a8d5ad6686cbe9228e", - "objectId": "610ef7a8d5ad6686cbe9228f", + "_id": "610f986c458521557bb21433", + "objectId": "610f986c458521557bb21434", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", "modifiedBy": "core:account:System", - "modifiedOn": 1628370856522, + "modifiedOn": 1628412012492, "objectSpace": "core:space:Model", "objectClass": "core:class:Attribute", "attributes": { @@ -672,12 +688,12 @@ } }, { - "_id": "610ef7a8d5ad6686cbe92290", - "objectId": "610ef7a8d5ad6686cbe92291", + "_id": "610f986c458521557bb21435", + "objectId": "610f986c458521557bb21436", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", "modifiedBy": "core:account:System", - "modifiedOn": 1628370856523, + "modifiedOn": 1628412012492, "objectSpace": "core:space:Model", "objectClass": "core:class:Attribute", "attributes": { @@ -690,12 +706,12 @@ } }, { - "_id": "610ef7a8d5ad6686cbe92292", - "objectId": "610ef7a8d5ad6686cbe92293", + "_id": "610f986c458521557bb21437", + "objectId": "610f986c458521557bb21438", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", "modifiedBy": "core:account:System", - "modifiedOn": 1628370856523, + "modifiedOn": 1628412012492, "objectSpace": "core:space:Model", "objectClass": "core:class:Attribute", "attributes": { @@ -708,13 +724,13 @@ } }, { - "_id": "610ef7a8d5ad6686cbe92294", + "_id": "610f986c458521557bb21439", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", "objectId": "task:class:Project", "objectClass": "core:class:Class", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856636, + "modifiedOn": 1628412012609, "modifiedBy": "core:account:System", "attributes": { "kind": 0, @@ -724,11 +740,11 @@ } }, { - "_id": "610ef7a8d5ad6686cbe92295", + "_id": "610f986c458521557bb2143a", "_class": "core:class:TxMixin", "space": "core:space:Tx", "modifiedBy": "core:account:System", - "modifiedOn": 1628370856636, + "modifiedOn": 1628412012609, "objectId": "task:class:Project", "objectClass": "core:class:Class", "objectSpace": "core:space:Model", @@ -741,13 +757,13 @@ } }, { - "_id": "610ef7a8d5ad6686cbe92296", + "_id": "610f986c458521557bb2143b", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", - "objectId": "610ef7a8d5ad6686cbe92297", + "objectId": "610f986c458521557bb2143c", "objectClass": "view:class:Viewlet", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856636, + "modifiedOn": 1628412012609, "modifiedBy": "core:account:System", "attributes": { "attachTo": "task:class:Task", @@ -765,13 +781,13 @@ } }, { - "_id": "610ef7a8d5ad6686cbe92298", + "_id": "610f986c458521557bb2143d", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", - "objectId": "610ef7a8d5ad6686cbe92299", + "objectId": "610f986c458521557bb2143e", "objectClass": "workbench:class:Application", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856636, + "modifiedOn": 1628412012609, "modifiedBy": "core:account:System", "attributes": { "label": "task:string:ApplicationLabelTask", @@ -789,13 +805,13 @@ } }, { - "_id": "610ef7a8d5ad6686cbe9229a", + "_id": "610f986c458521557bb2143f", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", - "objectId": "610ef7a8d5ad6686cbe9229b", + "objectId": "610f986c458521557bb21440", "objectClass": "task:class:Project", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856636, + "modifiedOn": 1628412012609, "modifiedBy": "core:account:System", "attributes": { "name": "demo", @@ -805,13 +821,13 @@ } }, { - "_id": "610ef7a8d5ad6686cbe9229c", + "_id": "610f986c458521557bb21441", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", "objectId": "recruit:class:Applicant", "objectClass": "core:class:Class", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856636, + "modifiedOn": 1628412012609, "modifiedBy": "core:account:System", "attributes": { "domain": "recruit", @@ -820,12 +836,12 @@ } }, { - "_id": "610ef7a8d5ad6686cbe9229d", - "objectId": "610ef7a8d5ad6686cbe9229e", + "_id": "610f986c458521557bb21442", + "objectId": "610f986c458521557bb21443", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", "modifiedBy": "core:account:System", - "modifiedOn": 1628370856630, + "modifiedOn": 1628412012602, "objectSpace": "core:space:Model", "objectClass": "core:class:Attribute", "attributes": { @@ -838,13 +854,13 @@ } }, { - "_id": "610ef7a8d5ad6686cbe9229f", + "_id": "610f986c458521557bb21444", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", "objectId": "recruit:class:Candidate", "objectClass": "core:class:Class", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856636, + "modifiedOn": 1628412012609, "modifiedBy": "core:account:System", "attributes": { "kind": 0, @@ -853,13 +869,13 @@ } }, { - "_id": "610ef7a8d5ad6686cbe922a0", + "_id": "610f986c458521557bb21445", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", "objectId": "recruit:class:Candidates", "objectClass": "core:class:Class", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856636, + "modifiedOn": 1628412012609, "modifiedBy": "core:account:System", "attributes": { "kind": 0, @@ -869,13 +885,13 @@ } }, { - "_id": "610ef7a8d5ad6686cbe922a1", + "_id": "610f986c458521557bb21446", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", "objectId": "recruit:class:Vacancy", "objectClass": "core:class:Class", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856636, + "modifiedOn": 1628412012609, "modifiedBy": "core:account:System", "attributes": { "kind": 0, @@ -885,11 +901,11 @@ } }, { - "_id": "610ef7a8d5ad6686cbe922a2", + "_id": "610f986c458521557bb21447", "_class": "core:class:TxMixin", "space": "core:space:Tx", "modifiedBy": "core:account:System", - "modifiedOn": 1628370856636, + "modifiedOn": 1628412012609, "objectId": "recruit:class:Vacancy", "objectClass": "core:class:Class", "objectSpace": "core:space:Model", @@ -902,11 +918,11 @@ } }, { - "_id": "610ef7a8d5ad6686cbe922a3", + "_id": "610f986c458521557bb21448", "_class": "core:class:TxMixin", "space": "core:space:Tx", "modifiedBy": "core:account:System", - "modifiedOn": 1628370856636, + "modifiedOn": 1628412012609, "objectId": "recruit:class:Candidates", "objectClass": "core:class:Class", "objectSpace": "core:space:Model", @@ -919,13 +935,13 @@ } }, { - "_id": "610ef7a8d5ad6686cbe922a4", + "_id": "610f986c458521557bb21449", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", - "objectId": "610ef7a8d5ad6686cbe922a5", + "objectId": "610f986c458521557bb2144a", "objectClass": "workbench:class:Application", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856636, + "modifiedOn": 1628412012609, "modifiedBy": "core:account:System", "attributes": { "label": "recruit:string:RecruitApplication", @@ -949,13 +965,13 @@ } }, { - "_id": "610ef7a8d5ad6686cbe922a6", + "_id": "610f986c458521557bb2144b", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", "objectId": "recruit:space:CandidatesPublic", "objectClass": "recruit:class:Candidates", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856636, + "modifiedOn": 1628412012609, "modifiedBy": "core:account:System", "attributes": { "name": "public", @@ -965,13 +981,13 @@ } }, { - "_id": "610ef7a8d5ad6686cbe922a7", + "_id": "610f986c458521557bb2144c", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", - "objectId": "610ef7a8d5ad6686cbe922a8", + "objectId": "610f986c458521557bb2144d", "objectClass": "view:class:Viewlet", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856636, + "modifiedOn": 1628412012609, "modifiedBy": "core:account:System", "attributes": { "attachTo": "recruit:class:Candidate", @@ -986,13 +1002,13 @@ } }, { - "_id": "610ef7a8d5ad6686cbe922a9", + "_id": "610f986c458521557bb2144e", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", - "objectId": "610ef7a8d5ad6686cbe922aa", + "objectId": "610f986c458521557bb2144f", "objectClass": "view:class:Viewlet", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856636, + "modifiedOn": 1628412012609, "modifiedBy": "core:account:System", "attributes": { "attachTo": "recruit:class:Applicant", @@ -1011,13 +1027,13 @@ } }, { - "_id": "610ef7a8d5ad6686cbe922ab", + "_id": "610f986c458521557bb21450", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", "objectId": "server-core:class:Trigger", "objectClass": "core:class:Class", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856636, + "modifiedOn": 1628412012609, "modifiedBy": "core:account:System", "attributes": { "domain": "model", @@ -1026,26 +1042,86 @@ } }, { - "_id": "610ef7a8d5ad6686cbe922ac", + "_id": "610f986c458521557bb21451", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", - "objectId": "610ef7a8d5ad6686cbe922ad", + "objectId": "610f986c458521557bb21452", "objectClass": "server-core:class:Trigger", "objectSpace": "core:space:Model", - "modifiedOn": 1628370856636, + "modifiedOn": 1628412012609, "modifiedBy": "core:account:System", "attributes": { "trigger": "server-chunter:trigger:OnMessage" } }, { - "_id": "610ef7a8d5ad6686cbe922ae", + "_id": "610f986c458521557bb21453", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", - "objectId": "610ef7a8d5ad6686cbe922af", + "objectId": "610f986c458521557bb21454", + "objectClass": "contact:class:Employee", + "objectSpace": "contact:space:Employee", + "modifiedOn": 1628412012609, + "modifiedBy": "core:account:System", + "attributes": { + "firstName": "Rosamund", + "lastName": "Chen", + "email": "rosamund@hc.engineering", + "phone": "+1 655 912 3424", + "city": "Mountain View" + } + }, + { + "_id": "610f986c458521557bb21455", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "610f986c458521557bb21456", + "objectClass": "core:class:Account", + "objectSpace": "core:space:Model", + "modifiedOn": 1628412012609, + "modifiedBy": "core:account:System", + "attributes": { + "email": "rosamund@hc.engineering" + } + }, + { + "_id": "610f986c458521557bb21457", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "610f986c458521557bb21458", + "objectClass": "contact:class:Employee", + "objectSpace": "contact:space:Employee", + "modifiedOn": 1628412012609, + "modifiedBy": "core:account:System", + "attributes": { + "firstName": "Elon", + "lastName": "Musk", + "email": "elon@hc.engineering", + "phone": "+1 655 843 3453", + "city": "Bel Air" + } + }, + { + "_id": "610f986c458521557bb21459", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "610f986c458521557bb2145a", + "objectClass": "core:class:Account", + "objectSpace": "core:space:Model", + "modifiedOn": 1628412012609, + "modifiedBy": "core:account:System", + "attributes": { + "email": "elon@hc.engineering" + } + }, + { + "_id": "610f986c458521557bb2145b", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "610f986c458521557bb2145c", "objectClass": "recruit:class:Candidate", "objectSpace": "recruit:space:CandidatesPublic", - "modifiedOn": 1628370856636, + "modifiedOn": 1628412012609, "modifiedBy": "core:account:System", "attributes": { "firstName": "Andrey", @@ -1056,13 +1132,13 @@ } }, { - "_id": "610ef7a8d5ad6686cbe922b0", + "_id": "610f986c458521557bb2145d", "_class": "core:class:TxCreateDoc", "space": "core:space:Tx", - "objectId": "610ef7a8d5ad6686cbe922b1", + "objectId": "610f986c458521557bb2145e", "objectClass": "recruit:class:Candidate", "objectSpace": "recruit:space:CandidatesPublic", - "modifiedOn": 1628370856636, + "modifiedOn": 1628412012609, "modifiedBy": "core:account:System", "attributes": { "firstName": "Marina", diff --git a/models/contact/src/index.ts b/models/contact/src/index.ts index 71a2f97302..fbdeb9e967 100644 --- a/models/contact/src/index.ts +++ b/models/contact/src/index.ts @@ -60,6 +60,13 @@ export class TEmployee extends TPerson implements Employee { export function createModel (builder: Builder): void { builder.createModel(TContact, TPerson, TOrganization, TEmployee) + builder.createDoc(core.class.Space, core.space.Model, { + name: 'Employees', + description: 'Employees', + private: false, + members: [] + }, contact.space.Employee) + builder.mixin(contact.class.Person, core.class.Class, view.mixin.AttributePresenter, { presenter: contact.component.PersonPresenter }) diff --git a/models/contact/src/plugin.ts b/models/contact/src/plugin.ts index 28725922f2..9d098e6604 100644 --- a/models/contact/src/plugin.ts +++ b/models/contact/src/plugin.ts @@ -14,7 +14,7 @@ // import { mergeIds } from '@anticrm/platform' -import type { Ref, Class } from '@anticrm/core' +import type { Ref, Class, Space } from '@anticrm/core' import contact, { contactId, Employee } from '@anticrm/contact' import type { AnyComponent } from '@anticrm/ui' import {} from '@anticrm/core' @@ -25,5 +25,8 @@ export const ids = mergeIds(contactId, contact, { }, class: { Employee: '' as Ref> + }, + space: { + Employee: '' as Ref } }) diff --git a/models/core/src/security.ts b/models/core/src/security.ts index 5ac0b34ca4..1fdd458f85 100644 --- a/models/core/src/security.ts +++ b/models/core/src/security.ts @@ -30,4 +30,6 @@ export class TSpace extends TDoc implements Space { } @Model(core.class.Account, core.class.Doc, DOMAIN_MODEL) -export class TAccount extends TDoc implements Account {} +export class TAccount extends TDoc implements Account { + email!: string +} diff --git a/models/demo/package.json b/models/demo/package.json index 4a7bfa8f33..5beb1ae1fb 100644 --- a/models/demo/package.json +++ b/models/demo/package.json @@ -20,6 +20,7 @@ "@anticrm/core": "~0.6.7", "@anticrm/model": "~0.6.0", "@anticrm/platform": "~0.6.3", - "@anticrm/model-recruit":"~0.6.0" + "@anticrm/model-recruit": "~0.6.0", + "@anticrm/model-contact": "~0.6.0" } } diff --git a/models/demo/src/index.ts b/models/demo/src/index.ts index 2e323322c7..d4d924951a 100644 --- a/models/demo/src/index.ts +++ b/models/demo/src/index.ts @@ -16,9 +16,35 @@ import { Builder } from '@anticrm/model' +import core from '@anticrm/core' +import contact from '@anticrm/model-contact' import recruit from '@anticrm/model-recruit' export function createDemo (builder: Builder): void { + builder.createDoc(contact.class.Employee, contact.space.Employee, { + firstName: 'Rosamund', + lastName: 'Chen', + email: 'rosamund@hc.engineering', + phone: '+1 655 912 3424', + city: 'Mountain View' + }) + + builder.createDoc(core.class.Account, core.space.Model, { + email: 'rosamund@hc.engineering' + }) + + builder.createDoc(contact.class.Employee, contact.space.Employee, { + firstName: 'Elon', + lastName: 'Musk', + email: 'elon@hc.engineering', + phone: '+1 655 843 3453', + city: 'Bel Air' + }) + + builder.createDoc(core.class.Account, core.space.Model, { + email: 'elon@hc.engineering' + }) + builder.createDoc(recruit.class.Candidate, recruit.space.CandidatesPublic, { firstName: 'Andrey', lastName: 'P.', diff --git a/packages/core/src/__tests__/memdb.test.ts b/packages/core/src/__tests__/memdb.test.ts index b326bec84e..1427f39895 100644 --- a/packages/core/src/__tests__/memdb.test.ts +++ b/packages/core/src/__tests__/memdb.test.ts @@ -153,7 +153,7 @@ describe('memdb', () => { private: false, members: [] }) - const account = await model.createDoc(core.class.Account, core.space.Model, {}) + const account = await model.createDoc(core.class.Account, core.space.Model, { email: 'email' }) await model.updateDoc(core.class.Space, core.space.Model, space, { $push: { members: account } }) const txSpace = await model.findAll(core.class.Space, { _id: space }) expect(txSpace[0].members).toEqual(expect.arrayContaining([account])) diff --git a/packages/core/src/classes.ts b/packages/core/src/classes.ts index 4fa1dfb94f..1ecfaa3bd7 100644 --- a/packages/core/src/classes.ts +++ b/packages/core/src/classes.ts @@ -175,4 +175,6 @@ export interface Space extends Doc { /** * @public */ -export interface Account extends Doc {} +export interface Account extends Doc { + email: string +}