Skip to content

Commit

Permalink
Fix CreatedAt, UpdatedAt for get workflow and template
Browse files Browse the repository at this point in the history
CreatedAt and UpdatedAt was wrong, this commit changed it to RFC.RFC3339

  +--------------------------------------+--------------------------------------+---------------+------------+------------+
  | ID                                   | TEMPLATE ID                          | STATE         | CREATED AT | UPDATED AT |
  +--------------------------------------+--------------------------------------+---------------+------------+------------+
  | 17ff6da3-7780-11eb-a192-ba5d1f2c0c0b | 63b550da-76e7-11eb-a192-ba5d1f2c0c0b | STATE_PENDING | 0xa71f90   | 0xa71f90   |
  +--------------------------------------+--------------------------------------+---------------+------------+------------+

Signed-off-by: Gianluca Arbezzano <[email protected]>
  • Loading branch information
Gianluca Arbezzano committed Feb 25, 2021
1 parent 19ec067 commit 658a8dd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
5 changes: 4 additions & 1 deletion cmd/tink-cli/cmd/template/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"io"
"log"
"time"

"github.com/google/uuid"
"github.com/jedib0t/go-pretty/table"
Expand Down Expand Up @@ -83,7 +84,9 @@ func (h *getTemplate) RetrieveData(ctx context.Context, cl *client.FullClient) (
func (h *getTemplate) PopulateTable(data []interface{}, t table.Writer) error {
for _, v := range data {
if tmp, ok := v.(*template.WorkflowTemplate); ok {
t.AppendRow(table.Row{tmp.Id, tmp.Name, tmp.CreatedAt.AsTime().Unix(), tmp.UpdatedAt.AsTime().Unix()})
t.AppendRow(table.Row{tmp.Id, tmp.Name,
tmp.CreatedAt.AsTime().Format(time.RFC3339),
tmp.UpdatedAt.AsTime().Format(time.RFC3339)})
}
}
return nil
Expand Down
10 changes: 5 additions & 5 deletions cmd/tink-cli/cmd/template/get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ func TestGetTemplate(t *testing.T) {
}(),
},
},
ExpectedStdout: `+--------------+------------+------------+------------+
| ID | NAME | CREATED AT | UPDATED AT |
+--------------+------------+------------+------------+
| template-123 | hello-test | 1451606400 | 1451606400 |
+--------------+------------+------------+------------+
ExpectedStdout: `+--------------+------------+----------------------+----------------------+
| ID | NAME | CREATED AT | UPDATED AT |
+--------------+------------+----------------------+----------------------+
| template-123 | hello-test | 2016-01-01T00:00:00Z | 2016-01-01T00:00:00Z |
+--------------+------------+----------------------+----------------------+
`,
},
}
Expand Down
5 changes: 3 additions & 2 deletions cmd/tink-cli/cmd/workflow/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"io"
"log"
"time"

"github.com/jedib0t/go-pretty/table"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -86,8 +87,8 @@ func (h *getWorkflow) PopulateTable(data []interface{}, t table.Writer) error {
if w, ok := v.(*workflow.Workflow); ok {
t.AppendRow(table.Row{w.Id, w.Template,
w.State.String(),
w.CreatedAt.AsTime().Unix,
w.UpdatedAt.AsTime().Unix})
w.CreatedAt.AsTime().UTC().Format(time.RFC3339),
w.UpdatedAt.AsTime().UTC().Format(time.RFC3339)})
}
}
return nil
Expand Down

0 comments on commit 658a8dd

Please sign in to comment.