From 7bd8a9dec0d78da9b674de030ba92a88448d7909 Mon Sep 17 00:00:00 2001 From: Albin Antony Date: Wed, 17 Jan 2024 18:22:33 +0530 Subject: [PATCH] Add #616 Add consentRecord and revision objects to the response of update signature endpoint --- .../v2/service/service_update_signature_object.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/internal/handler/v2/service/service_update_signature_object.go b/internal/handler/v2/service/service_update_signature_object.go index 503b5d7..6c9b1a3 100644 --- a/internal/handler/v2/service/service_update_signature_object.go +++ b/internal/handler/v2/service/service_update_signature_object.go @@ -42,7 +42,9 @@ type updateSignatureforDataAgreementRecordReq struct { } type updateSignatureforDataAgreementRecordResp struct { - Signature signature.Signature `json:"signature"` + DataAgreementRecord daRecord.DataAgreementRecord `json:"consentRecord"` + Revision revision.Revision `json:"revision"` + Signature signature.Signature `json:"signature"` } func ServiceUpdateSignatureObject(w http.ResponseWriter, r *http.Request) { @@ -119,7 +121,7 @@ func ServiceUpdateSignatureObject(w http.ResponseWriter, r *http.Request) { toBeUpdatedDaRecord.State = config.Signed // Save data agreement to db - _, err = darRepo.Update(toBeUpdatedDaRecord) + savedDaRecord, err := darRepo.Update(toBeUpdatedDaRecord) if err != nil { m := "Failed to update data agreement record" common.HandleErrorV2(w, http.StatusInternalServerError, m, err) @@ -137,7 +139,7 @@ func ServiceUpdateSignatureObject(w http.ResponseWriter, r *http.Request) { newRevision.SerializedHash = savedSignature.VerificationPayloadHash // Save the revision to db - _, err = revision.Add(newRevision) + savedRevision, err := revision.Add(newRevision) if err != nil { m := fmt.Sprintf("Failed to create new revision: %v", newRevision.Id) common.HandleErrorV2(w, http.StatusInternalServerError, m, err) @@ -145,7 +147,9 @@ func ServiceUpdateSignatureObject(w http.ResponseWriter, r *http.Request) { } resp := updateSignatureforDataAgreementRecordResp{ - Signature: savedSignature, + DataAgreementRecord: savedDaRecord, + Revision: savedRevision, + Signature: savedSignature, } response, _ := json.Marshal(resp)