Skip to content

Commit

Permalink
Org repository sets deletion time
Browse files Browse the repository at this point in the history
[#2605]

Co-authored-by: Dave Walter <walterda@vmware.com>
  • Loading branch information
acosta11 and davewalter committed Jul 6, 2023
1 parent 15a6880 commit 75ec3f2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions api/repositories/org_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,11 @@ func (r *OrgRepo) PatchOrgMetadata(ctx context.Context, authInfo authorization.I

func cfOrgToOrgRecord(cfOrg korifiv1alpha1.CFOrg) OrgRecord {
updatedAtTime, _ := getTimeLastUpdatedTimestamp(&cfOrg.ObjectMeta)
deletedAtTime := ""
if cfOrg.DeletionTimestamp != nil {
deletedAtTime = formatTimestamp(*cfOrg.DeletionTimestamp)
}

return OrgRecord{
GUID: cfOrg.Name,
Name: cfOrg.Spec.DisplayName,
Expand All @@ -252,5 +257,6 @@ func cfOrgToOrgRecord(cfOrg korifiv1alpha1.CFOrg) OrgRecord {
Annotations: cfOrg.Annotations,
CreatedAt: formatTimestamp(cfOrg.CreationTimestamp),
UpdatedAt: updatedAtTime,
DeletedAt: deletedAtTime,
}
}
1 change: 1 addition & 0 deletions api/repositories/org_repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ var _ = Describe("OrgRepository", func() {
updatedAt, err := time.Parse(time.RFC3339, org.UpdatedAt)
Expect(err).NotTo(HaveOccurred())
Expect(updatedAt).To(BeTemporally("~", time.Now(), 2*time.Second))
Expect(org.DeletedAt).To(BeEmpty())
Expect(org.Labels).To(Equal(map[string]string{"test-label-key": "test-label-val"}))
Expect(org.Annotations).To(Equal(map[string]string{"test-annotation-key": "test-annotation-val"}))
})
Expand Down

0 comments on commit 75ec3f2

Please sign in to comment.