Skip to content

Commit

Permalink
feat: add destination LastSeenAt
Browse files Browse the repository at this point in the history
  • Loading branch information
mxyng committed Jul 4, 2022
1 parent a04e90b commit accc0b9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions api/destination.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ type Destination struct {

Resources []string `json:"resources"`
Roles []string `json:"roles"`

LastSeen Time `json:"lastSeen"`
}

type DestinationConnection struct {
Expand Down
8 changes: 6 additions & 2 deletions internal/server/models/destination.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
package models

import (
"time"

"github.com/infrahq/infra/api"
)

type Destination struct {
Model

Name string `validate:"required"`
UniqueID string `gorm:"uniqueIndex:idx_destinations_unique_id,where:deleted_at is NULL"`
Name string `validate:"required"`
UniqueID string `gorm:"uniqueIndex:idx_destinations_unique_id,where:deleted_at is NULL"`
LastSeenAt time.Time

ConnectionURL string
ConnectionCA string
Expand All @@ -30,5 +33,6 @@ func (d *Destination) ToAPI() *api.Destination {
},
Resources: d.Resources,
Roles: d.Roles,
LastSeen: api.Time(d.LastSeenAt),
}
}

0 comments on commit accc0b9

Please sign in to comment.