Skip to content

Commit

Permalink
feat: initial parsing of client payload into JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
Dara Hayes committed Feb 20, 2018
1 parent 8b1580b commit 471ed8b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 22 deletions.
12 changes: 0 additions & 12 deletions pkg/dao/dao.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,6 @@ func (m *MetricsDAO) Create(metric mobile.Metric) (mobile.Metric, error) {
return metric, errors.New("Not Implemented yet")
}

// Update an existing job
// Not sure if we need this
func (m *MetricsDAO) Update() {

}

// Delete an existing job
// Not sure if we need this
func (m *MetricsDAO) Delete() {

}

// Ping checks that we are connected to the database
// This will be used by the healthcheck
func (m *MetricsDAO) Ping() error {
Expand Down
6 changes: 1 addition & 5 deletions pkg/mobile/metrics.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package mobile

import (
"errors"
)

type MetricsService struct {
mdao MetricCreator
}
Expand All @@ -13,5 +9,5 @@ func NewMetricsService(dao MetricCreator) *MetricsService {
}

func (m MetricsService) Create(metric Metric) (Metric, error) {
return metric, errors.New("This is an error")
return metric, nil
}
20 changes: 15 additions & 5 deletions pkg/mobile/types.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
package mobile

import "time"

type AppConfig struct {
DBConnectionString string
}

// ClientMetric struct is what the client payload should be parsed into
// Need to figure out how to structure this
type Metric struct {
Timestamp time.Time `json:"timestamp"`
ClientID string `json:"clientId"`
Data interface{} `json:"data"`
ClientTimestamp int64 `json:"timestamp"`
ClientId string `json:"clientId"`
App AppMetric `json:"app"`
Device DeviceMetric `json:"device"`
}

type AppMetric struct {
ID string `json:"id"`
SDKVersion string `json:"sdkVersion"`
AppVersion string `json:"appVersion"`
}

type DeviceMetric struct {
Platform string `json:"platform"`
PlatformVersion string `json:"platformVersion"`
}

0 comments on commit 471ed8b

Please sign in to comment.