diff --git a/README.md b/README.md index a8580e2eeae8026b0e55d07eac8f5e98f135a3d5..9451538aedd2a4ca44dd35836b01608566474fc3 100644 --- a/README.md +++ b/README.md @@ -50,3 +50,9 @@ python manage.py runserver ~~~ python manage.py shell ~~~ + +## Links to official documentations + +* Django: <https://docs.djangoproject.com/en/3.1/> +* Neomodel: <https://neomodel.readthedocs.io/en/latest/> +* Neo4j: <https://neo4j.com/docs/> \ No newline at end of file diff --git a/dataproc/api/models/__pycache__/construct_model.cpython-38.pyc b/dataproc/api/models/__pycache__/construct_model.cpython-38.pyc index fd1129b42abca1dd1fcddc931d2e6694d81671c0..017711cdc0d89b74d0388696f01015630d9989e2 100644 Binary files a/dataproc/api/models/__pycache__/construct_model.cpython-38.pyc and b/dataproc/api/models/__pycache__/construct_model.cpython-38.pyc differ diff --git a/dataproc/api/models/__pycache__/user_model.cpython-38.pyc b/dataproc/api/models/__pycache__/user_model.cpython-38.pyc index f98b4d63d02801c550c7abf040b4ad4996ea33fc..124c1d3eeb4eb349b4bf0215342c8e3dd41b4d14 100644 Binary files a/dataproc/api/models/__pycache__/user_model.cpython-38.pyc and b/dataproc/api/models/__pycache__/user_model.cpython-38.pyc differ diff --git a/dataproc/api/models/construct_model.py b/dataproc/api/models/construct_model.py index c8e9bed72998160ac67e7f1af81d7f953beda06a..a30b07697eaf1ef22694c3d3d59a5da5ec2902da 100644 --- a/dataproc/api/models/construct_model.py +++ b/dataproc/api/models/construct_model.py @@ -1,5 +1,4 @@ from neomodel import StructuredNode, StringProperty, IntegerProperty,UniqueIdProperty, RelationshipTo -from uuid import uuid4 # from api.models.ocf_model import OCF # from api.models.storagehost_model import StorageHost @@ -8,7 +7,7 @@ from uuid import uuid4 class Construct(StructuredNode): - uid=UniqueIdProperty(default=uuid4) + uuid=UniqueIdProperty() name=StringProperty() # Relationships diff --git a/dataproc/api/views/__pycache__/construct_view.cpython-38.pyc b/dataproc/api/views/__pycache__/construct_view.cpython-38.pyc index c24e15ba959a8420bb8150cc5e607ef7ab1007e1..13b68bcecf4037397d998666a0ed08b8b0274832 100644 Binary files a/dataproc/api/views/__pycache__/construct_view.cpython-38.pyc and b/dataproc/api/views/__pycache__/construct_view.cpython-38.pyc differ diff --git a/dataproc/api/views/__pycache__/user_view.cpython-38.pyc b/dataproc/api/views/__pycache__/user_view.cpython-38.pyc index b070008616c5c8ea82b23831cf7bb03f3216884c..3dae84405ea6ea50f29e2105b00837c6473b49f6 100644 Binary files a/dataproc/api/views/__pycache__/user_view.cpython-38.pyc and b/dataproc/api/views/__pycache__/user_view.cpython-38.pyc differ diff --git a/dataproc/api/views/construct_view.py b/dataproc/api/views/construct_view.py index 5c383c591563c21b8aaf0c9c971b3d48c8924fc1..95698231dfbad0bccc2ba82b09233c9822d49e52 100644 --- a/dataproc/api/views/construct_view.py +++ b/dataproc/api/views/construct_view.py @@ -24,7 +24,7 @@ def indexConstruct(request): response=[] for construct in constructs : obj= { - "uid": construct.uid, + "uuid": construct.uuid, "name": construct.name, } response.append(obj) @@ -43,7 +43,7 @@ def showConstruct(request): name=request.GET.get('name', ' ') try: construct=Construct.nodes.get(name=name) - return JsonResponse({"uid": construct.uid, "name": construct.name}, safe=False) + return JsonResponse({"uuid": construct.uuid, "name": construct.name}, safe=False) except : return JsonResponse({"error":"Error occurred"}, safe=False) @@ -60,7 +60,7 @@ def storeConstruct(request): try: construct=Construct(name=name) construct.save() - return JsonResponse({"uid": construct.uid}) + return JsonResponse({"uuid": construct.uuid}) except : return JsonResponse({"error":"Error occurred"}, safe=False) @@ -74,12 +74,12 @@ def updateConstruct(request): if request.method=='PUT': json_data=json.loads(request.body) name=json_data['name'] - uid=json_data['uid'] + uuid=json_data['uuid'] try: - construct=Construct.nodes.get(uid=uid) + construct=Construct.nodes.get(uuid=uuid) construct.name=name construct.save() - return JsonResponse({"uid": construct.uid, "name": name}, safe=False) + return JsonResponse({"uuid": construct.uuid, "name": name}, safe=False) except: return JsonResponse({"error":"Error occurred"}, safe=False) @@ -87,14 +87,14 @@ def updateConstruct(request): def destroyConstruct(request): """ - Delete one construct by uid + Delete one construct by uuid """ if request.method=='DELETE': json_data=json.loads(request.body) - uid=json_data['uid'] + uuid=json_data['uuid'] try: - construct=Construct.nodes.get(uid=uid) + construct=Construct.nodes.get(uuid=uuid) construct.delete() return JsonResponse({"success": "Construct deleted"}, safe=False) except: diff --git a/dataproc/api/views/connectors.py b/dataproc/api/views/relationships_view.py similarity index 99% rename from dataproc/api/views/connectors.py rename to dataproc/api/views/relationships_view.py index 73ac2fa6b06323a169adbf8ca2a2dd3d1910c24a..9f1f3480f9bce3ebffeb6b8437dfb7cf22488602 100644 --- a/dataproc/api/views/connectors.py +++ b/dataproc/api/views/relationships_view.py @@ -1,8 +1,10 @@ # from django.http import JsonResponse -# from api.models import * # from django.views.decorators.csrf import csrf_exempt # import json +# from api.models import * + + # @csrf_exempt # def connectConstructUser(request): # if request.method == 'PUT': diff --git a/dataproc/api/views/user_view.py b/dataproc/api/views/user_view.py index 0c0537b2ac06844d3cc65574a7c3cc355c8b29ba..a86e98ceed96d5983947ad7e7cbcc298099639b3 100644 --- a/dataproc/api/views/user_view.py +++ b/dataproc/api/views/user_view.py @@ -20,7 +20,7 @@ def indexUser(request): if request.method=='GET': try: - users=User.nodes.all() + users=User.nodes.all(lazy=False) response=[] for user in users : obj= { @@ -43,7 +43,8 @@ def showUser(request): name=request.GET.get('name', ' ') try: user=User.nodes.get(name=name) - return JsonResponse({"uid": user.uid, "name": user.name}, safe=False) + # return JsonResponse({"uid": user.uid, "name": user.name}, safe=False) + return JsonResponse({user}, safe=False) except : return JsonResponse({"error":"Error occurred"}, safe=False)