From ad06e9d931d78ef12de2e006524fa5ff1b144b43 Mon Sep 17 00:00:00 2001 From: Lz Date: Thu, 2 Feb 2023 13:17:50 +0800 Subject: [PATCH] fix(listall): fixed json output (#348) * fix(listall): fixed json output * fix(listall): fixed json output --- cmd/list.go | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/cmd/list.go b/cmd/list.go index da0972f5..eb651005 100644 --- a/cmd/list.go +++ b/cmd/list.go @@ -5,6 +5,7 @@ import ( "strconv" "strings" + "github.com/0chain/gosdk/core/common" "github.com/0chain/gosdk/zboxcore/fileref" "github.com/0chain/gosdk/zboxcore/sdk" "github.com/0chain/zboxcli/util" @@ -106,13 +107,15 @@ var listAllCmd = &cobra.Command{ } type fileResp struct { - Name string `json:"name"` - Path string `json:"path"` - Type string `json:"type"` - Size int64 `json:"size"` - Hash string `json:"hash,omitempty"` - LookupHash string `json:"lookup_hash"` - EncryptedKey string `json:"encrypted_key,omitempty" ` + Name string `json:"name"` + Path string `json:"path"` + Type string `json:"type"` + Size int64 `json:"size"` + Hash string `json:"hash,omitempty"` + LookupHash string `json:"lookup_hash"` + EncryptedKey string `json:"encrypted_key,omitempty" ` + CreatedAt common.Timestamp `json:"created_at"` + UpdatedAt common.Timestamp `json:"updated_at"` } fileResps := make([]fileResp, 0) @@ -126,6 +129,8 @@ var listAllCmd = &cobra.Command{ Hash: data.Hash, EncryptedKey: data.EncryptedKey, LookupHash: data.LookupHash, + CreatedAt: common.Timestamp(data.CreatedAt.Unix()), + UpdatedAt: common.Timestamp(data.UpdatedAt.Unix()), } fileResps = append(fileResps, resp) }