From 22ffe9d0ad143a85cfa24b9f9e919bf281d0affd Mon Sep 17 00:00:00 2001
From: diazjj <jjdiaz@cttc.es>
Date: Fri, 26 Jul 2024 15:15:50 +0200
Subject: [PATCH] Debugging

---
 src/dlt/connector/service/tools/Checkers.py | 2 +-
 src/dlt/gateway/dltApp/src/dltGateway.js    | 9 +++++++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/dlt/connector/service/tools/Checkers.py b/src/dlt/connector/service/tools/Checkers.py
index 94a10d409..6ad0f4b82 100644
--- a/src/dlt/connector/service/tools/Checkers.py
+++ b/src/dlt/connector/service/tools/Checkers.py
@@ -20,5 +20,5 @@ def record_exists(record : DltRecord) -> bool:
     exists = exists and (record.record_id.type != DLTRECORDTYPE_UNDEFINED)
     exists = exists and (len(record.record_id.record_uuid.uuid) > 0)
     #exists = exists and (record.operation != DLTRECORDOPERATION_UNDEFINED)
-    #exists = exists and (len(record.data_json) > 0)
+    exists = exists and (len(record.data_json) > 0)
     return exists
diff --git a/src/dlt/gateway/dltApp/src/dltGateway.js b/src/dlt/gateway/dltApp/src/dltGateway.js
index 0dcfb7508..ba9a67a31 100644
--- a/src/dlt/gateway/dltApp/src/dltGateway.js
+++ b/src/dlt/gateway/dltApp/src/dltGateway.js
@@ -93,7 +93,7 @@ async function getFromDlt(call, callback) {
   try {
 
     console.log("RECEIVED CALL REQUEST:", call.request);
-    const { record_uuid } = call.request;
+    //const { record_id, operation, data_json } = call.request;
     const resultBytes = await contractInstance.evaluateTransaction('RetrieveRecord', JSON.stringify(call.request));
     // Decode and parse the result
     const resultJson = utf8Decoder.decode(resultBytes);
@@ -105,7 +105,12 @@ async function getFromDlt(call, callback) {
    if (error.message.includes("data not found for key")) {
     // Return an empty response when no record is found
     console.log("REQUEST ERROR:", error);
-    callback(null, { record_id: call.request, data_json: "" });
+    const emptyRecordId = {
+      domain_uuid: { uuid: "" },
+      type: 'DLTRECORDTYPE_UNDEFINED',
+      record_uuid: { uuid: "" }
+    };
+    callback(null, { record_id: emptyRecordId, data_json: "" });
   } else {
     // Send failure response with error message
     callback({
-- 
GitLab