2017-06-04 4 views
0

私は参加者と資産をネットワークに追加するトランザクションを作成しています。参加者をネットワークに追加することはできますが、メディカルアセットファイルレジストリにアクセスしようとすると、関数は未定義に戻ります。未定義は呼び出し不可能

Error: TypeError: undefined not callable

トランザクションのロジック:

return getParticipantRegistry(namespace + '.Patient') 
     .then(function (patientRegistry) { 
      return patientRegistry.add(newPatient); 
     }).then(function() { 
      return getAssetRegistry('nl.epd.blockchain.MedicalFile'); 
     }).then(function (registry) { 
      var medicalFile = factory.newResource(namespace, 'MedicalFile', "test"); 
      medicalFile.id = "test"; 
      medicalFile.owner = newPatient.bsn; 
      medicalFile.mentors = []; 
      medicalFile.permissions = []; 
      medicalFile.allergies = []; 
      medicalFile.treatments = []; 
      medicalFile.medicine = []; 

      // registry is undefined 
      return registry.add(medicalFile); 
     }); 
} 

モデル:

namespace nl.epd.blockchain 

asset MedicalFile identified by id { 
    o String      id 
    --> Patient     owner 
    --> Patient[]     mentors 
    o OrganisationPermission[] permissions 
    o Visit[]     visits 
    o String[]     allergies 
    o Treatment[]    treatments 
    o Medicine[]    medicine 
} 

participant Patient identified by bsn { 
    o String bsn 
    o String firstName 
    o String namePrefix optional 
    o String lastName 
    o String email 
    o String telephoneNumber 
    o String birthday 
    o String gender 
    o String city 
    o String zipCode 
    o String street 
    o String houseNumber 
    o String houseNumberExtra optional 
} 

NPMの依存関係:

"dependencies": { 
    "fabric-ca-client": "1.0.0-alpha.0", 
    "fabric-client": "1.0.0-alpha", 
    "homedir": "^0.6.0", 
    "composer-client": "^0.7.0", 
    "composer-rest-server": "^0.7.0" 
    } 

間違って何任意のアイデア?

答えて

1

レジストリが空であるという前提が正しくありませんでした。問題は所有者が関係ではないということでした。それはただの文字列だった、私はそれが許されたと思った。

これは上記のエラーを引き起こしました。

修正:

medicalFile.owner = factory.newRelationship(namespace, 'Patient', newPatient.bsn); 
関連する問題