From bdb1fc18eff62034e49769c5d683891a0f2cae13 Mon Sep 17 00:00:00 2001 From: root <Yorgo EL MOUBAYED> Date: Thu, 8 Apr 2021 13:42:03 +0200 Subject: [PATCH] update construct and user models --- .../construct_model.cpython-38.pyc | Bin 836 -> 1468 bytes .../__pycache__/user_model.cpython-38.pyc | Bin 586 -> 586 bytes dataproc/api/models/construct_model.py | 33 +++++++++++++++++- dataproc/api/models/user_model.py | 17 ++++----- 4 files changed, 41 insertions(+), 9 deletions(-) diff --git a/dataproc/api/models/__pycache__/construct_model.cpython-38.pyc b/dataproc/api/models/__pycache__/construct_model.cpython-38.pyc index 17850e70c9d75bed0812e897e321a9d1e6824fd4..a22b72e02b5de3003c20375479ad908db9670488 100644 GIT binary patch literal 1468 zcmZuxJ8#@Z5Z)J$yr%>|5W@(PHV4GI#_0mXfr40W&PF6PTZCb_D~UE=-X-na!JXU& z`2#NOQh#aNRH@Usa5A%`&omq!IQaJ4+2MRMvv)e5PY67JzSO^dHzMROTnrxpi~I1} zBQT06nv;S`S}@59E_orOC;}N!+++Eu2xaIo&!b{2$CNxEN~qu!QGuqHTu#*Jm@LD; zAsSf*ZgJe0Hf>s?)w)vJue0*}v8ifpnvL6gST_1xn;o%#T4v8${ZQ?g#m_oVnyf1A zMOL3wOX`BQ&D320V~ly)WVuc8d&6g^>la`(kyH`MG*?s$#r|M2(EO6fkq#AC;*!Y- zP~g!R(8!|+pwOeKo~cNUUy(~H=YS__>hVI&K<(U(4<S9T^km80to0h=tW^4U7b<<0 zw0X0=mDJfm0U77^pi0kT4-Xz4{v`R)569bY2HUo&OmeO-D%<pK#~pJ7%=X)XXId3? z+dxSNzK0(;?|pmV-CAw>fTsXcIw%=ptlA;G_8J&PUy>&TUaHt@mQhg3*KV%_1##Uq zFw^#mIf4CfqD%^H=5X+eI$?Ewc0~-vdG}~_Q5AZ%(Rop|za<;3RzGU{w5jS<sbAbt z^&QCNd6w#xN}2>hrz^;L)s<?Mekg69c)f9B@XwMw+v=N`te<essG#D#_;-7K*NlUm z-)BlAIOvt006?X0ywW%9EqUwpD&BK^z=@s{11{*f;3Ib~pjM-`<j~wDlM^hNjhjua z<-EfNXId*c9rRVsKWUs3*rMe~ez8*#`(yo8u#&?RIiBRXoDK#?&Oez6=nkAW`ykVI zqchiG>27`u3`H(=>TlUsuw`$9A%fAxdl7tQ|Ji>1KP8R_G1kjH7sWA7L>#+GjIC>P z#Irbl)+TwkV>o=pglHCM_Rzq;6p`UYVq=ge_Yw5!Vw`b#4Vj(9j*E~(oi6Gpb7O8` zuv=(w2nPnWn=u%i8;foco6!-UQ2%3$P9jFV$9g$+QK>6GiiY7qpEBMP6QIFtyW~-Z nyfL_J*lD<$xivU!KHeY;pOkMy^nF*Idw2sa2K<uF=q&sX8CR8c delta 202 zcmdnPeT0oKl$V!_0SLG+CMCRPn#d=^Xfsh;Tg;syg*k<#g&~C{m9d#QiX(+Jm_d_m zVns4z@<c&NMz_h#jIL}c96&+N$!Ux`nEf<)CRefO@!Vo5EzL~1#gdnpn>u+Diyh}m zh9Uu=@kIiY8<|3sia3C5P9QGk0TLWcJdAA2T#O(Hmhl6c=ESON0OmmTfi;5&K_GF9 X!zMRBr8FnijuFT!W&sj1j6CcBiBKn6 diff --git a/dataproc/api/models/__pycache__/user_model.cpython-38.pyc b/dataproc/api/models/__pycache__/user_model.cpython-38.pyc index 1b3b54bbf0ceb6cabd85b768ab87a865379c0e4d..fde8a6f5083ab79f7061d53605ab65c1e8e74a26 100644 GIT binary patch delta 22 ccmX@ba*BmFl$V!_0SG=+r6%m%$ZN|407Byi3;+NC delta 22 ccmX@ba*BmFl$V!_0SLG+CM7U!<h5l206EeGzyJUM diff --git a/dataproc/api/models/construct_model.py b/dataproc/api/models/construct_model.py index 34141f1..0405989 100644 --- a/dataproc/api/models/construct_model.py +++ b/dataproc/api/models/construct_model.py @@ -1,5 +1,6 @@ from neomodel import StructuredNode, StringProperty, IntegerProperty,UniqueIdProperty, RelationshipTo from uuid import uuid4 +from api.models.nodeutils import NodeUtils # from api.models.ocf_model import OCF # from api.models.storagehost_model import StorageHost @@ -15,4 +16,34 @@ class Construct(StructuredNode): has_ocf=RelationshipTo('api.models.ocf_model.OCF', 'HAS') has_storage_host=RelationshipTo('api.models.storagehost_model.StorageHost', 'HAS') has_computing_host=RelationshipTo('api.models.computinghost_model.ComputingHost', 'HAS') - has_user=RelationshipTo('api.models.user_model.User', 'HAS') \ No newline at end of file + has_user=RelationshipTo('api.models.user_model.User', 'HAS') + + @property + def serialize(self): + return { + 'node_properties': { + 'uuid': self.uuid, + 'name': self.name, + }, + } + + @property + def serialize_connections(self): + return [ + { + 'nodes_type': 'OCF', + 'nodes_related': self.serialize_relationships(self.ocf.all()), + }, + { + 'nodes_type': 'StorageHost', + 'nodes_related': self.serialize_relationships(self.storagehost.all()), + }, + { + 'nodes_type': 'ComputingHost', + 'nodes_related': self.serialize_relationships(self.computinghost.all()), + }, + { + 'nodes_type': 'User', + 'nodes_related': self.serialize_relationships(self.user.all()), + }, + ] diff --git a/dataproc/api/models/user_model.py b/dataproc/api/models/user_model.py index 0f415a0..fe84f9a 100644 --- a/dataproc/api/models/user_model.py +++ b/dataproc/api/models/user_model.py @@ -6,12 +6,13 @@ class User(StructuredNode): name=StringProperty() surname=StringProperty() - @property - def serialize(self): - return { - 'node_properties': { - 'uuid': self.uuid, - 'username': self.username, - }, - } + # @property + # def serialize(self): + # return { + # 'node_properties': { + # 'uuid': self.uuid, + # 'username': self.username, + # }, + # } + -- GitLab