Writing of Schema Struct to PDC working

This commit is contained in:
Fernando Garzon 2023-02-22 09:25:56 -08:00
parent e1169e061e
commit 4918ef433b

View file

@ -850,10 +850,10 @@ func (s *SmartContract) WriteSchemaToPDC(ctx contractapi.TransactionContextInter
} }
type transientInput struct { type transientInput struct {
//JsonSchemaContent map[string]interface{} `json:"JsonSchemaContent"` JsonSchemaContent map[string]interface{} `json:"JsonSchemaContent"`
JsonSchemaContent string `json:"JsonSchemaContent"` //JsonSchemaContent string `json:"JsonSchemaContent"`
SchemaId string `json:"SchemaId"` SchemaId string `json:"SchemaId"`
Project string `json:"Project` Project string `json:"Project`
} }
// So far, we've taken what's on the transient dictionary and unmarshal it into the transientInput Struct // So far, we've taken what's on the transient dictionary and unmarshal it into the transientInput Struct
@ -862,10 +862,11 @@ func (s *SmartContract) WriteSchemaToPDC(ctx contractapi.TransactionContextInter
if err != nil { if err != nil {
return fmt.Errorf("failed to unmarshal JSON: %v", err) return fmt.Errorf("failed to unmarshal JSON: %v", err)
} }
jsonFileContent, err := s.JsonReader(ctx, assetInput.JsonSchemaContent) jsonFileContent := assetInput.JsonSchemaContent
if err != nil { //jsonFileContent, err := s.JsonReader(ctx, assetInput.JsonSchemaContent)
return err //if err != nil {
} //return err
//}
// Check if Schema already exists // Check if Schema already exists
assetAsBytes, err := ctx.GetStub().GetPrivateData(PDC1, assetInput.SchemaId) assetAsBytes, err := ctx.GetStub().GetPrivateData(PDC1, assetInput.SchemaId)
if err != nil { if err != nil {