Skip to content

Commit

Permalink
Used ts column instead of epoch
Browse files Browse the repository at this point in the history
  • Loading branch information
Eisei24 committed Oct 31, 2024
1 parent edb982b commit e9a78e3
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions backend/pkg/api/data_access/notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ func (d *DataAccessService) GetMachineNotifications(ctx context.Context, userId
// -------------------------------------
// Get the machine notification history
notificationHistory := []struct {
Epoch uint64 `db:"epoch"`
Ts time.Time `db:"ts"`
MachineId uint64 `db:"machine_id"`
MachineName string `db:"machine_name"`
EventType types.EventName `db:"event_type"`
Expand All @@ -720,7 +720,7 @@ func (d *DataAccessService) GetMachineNotifications(ctx context.Context, userId

ds := goqu.Dialect("postgres").
Select(
goqu.L("epoch"),
goqu.L("ts"),
goqu.L("machine_id"),
goqu.L("machine_name"),
goqu.L("event_type"),
Expand Down Expand Up @@ -771,7 +771,7 @@ func (d *DataAccessService) GetMachineNotifications(ctx context.Context, userId
resultEntry := t.NotificationMachinesTableRow{
MachineName: notification.MachineName,
Threshold: notification.EventThreshold,
Timestamp: utils.EpochToTime(notification.Epoch).Unix(),
Timestamp: notification.Ts.Unix(),
}
switch notification.EventType {
case types.MonitoringMachineOfflineEventName:
Expand Down Expand Up @@ -833,15 +833,15 @@ func (d *DataAccessService) GetClientNotifications(ctx context.Context, userId u
// -------------------------------------
// Get the client notification history
notificationHistory := []struct {
Epoch uint64 `db:"epoch"`
Client string `db:"client"`
Version string `db:"client_version"`
Url string `db:"client_url"`
Ts time.Time `db:"ts"`
Client string `db:"client"`
Version string `db:"client_version"`
Url string `db:"client_url"`
}{}

ds := goqu.Dialect("postgres").
Select(
goqu.L("epoch"),
goqu.L("ts"),
goqu.L("client"),
goqu.L("client_version"),
goqu.L("client_url")).
Expand Down Expand Up @@ -884,7 +884,7 @@ func (d *DataAccessService) GetClientNotifications(ctx context.Context, userId u
ClientName: notification.Client,
Version: notification.Version,
Url: notification.Url,
Timestamp: utils.EpochToTime(notification.Epoch).Unix(),
Timestamp: notification.Ts.Unix(),
}
result = append(result, resultEntry)
}
Expand Down Expand Up @@ -935,15 +935,15 @@ func (d *DataAccessService) GetNetworkNotifications(ctx context.Context, userId
// -------------------------------------
// Get the network notification history
notificationHistory := []struct {
Epoch uint64 `db:"epoch"`
Ts time.Time `db:"ts"`
Network uint64 `db:"network"`
EventType types.EventName `db:"event_type"`
EventThreshold float64 `db:"event_threshold"`
}{}

ds := goqu.Dialect("postgres").
Select(
goqu.L("epoch"),
goqu.L("ts"),
goqu.L("network"),
goqu.L("event_type"),
goqu.L("event_threshold")).
Expand Down Expand Up @@ -980,7 +980,7 @@ func (d *DataAccessService) GetNetworkNotifications(ctx context.Context, userId
for _, notification := range notificationHistory {
resultEntry := t.NotificationNetworksTableRow{
ChainId: notification.Network,
Timestamp: utils.EpochToTime(notification.Epoch).Unix(),
Timestamp: notification.Ts.Unix(),
}
switch notification.EventType {
case types.NetworkGasAboveThresholdEventName:
Expand Down

0 comments on commit e9a78e3

Please sign in to comment.