From 072db987127656f14299c63aa2e157a3ccdea691 Mon Sep 17 00:00:00 2001 From: stremovsky Date: Fri, 13 Dec 2019 14:30:05 +0200 Subject: [PATCH] return list of user tokens with specific consent --- src/consent_db.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/consent_db.go b/src/consent_db.go index cfee697..2d0f7f5 100644 --- a/src/consent_db.go +++ b/src/consent_db.go @@ -107,7 +107,15 @@ func (dbobj dbcon) filterConsentRecords(brief string, offset int32, limit int32) return nil, 0, err } records, err := dbobj.getList(TblName.Consent, "brief", brief, offset, limit) - resultJSON, err := json.Marshal(records) + if err != nil { + return nil, 0, err + } + // we need to return only list of tokens + var result []string + for _, rec := range records { + result = append(result, rec["token"].(string)) + } + resultJSON, err := json.Marshal(result) //fmt.Printf("Found multiple documents (array of pointers): %+v\n", results) return resultJSON, count, nil }