-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implemented reports query #1
Conversation
|
||
// genericQuery is a generic-resolver for Inventory GraphQL-query. | ||
// Other queries call this function. | ||
var genericQuery = func(serviceAction string, params graphql.ResolveParams) (interface{}, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
genericQuery
is unused
@@ -0,0 +1,137 @@ | |||
package resolver |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1-137 lines are duplicate of gql/entity/inventory/resolver/query.go:1-137
type ReportResult struct { | ||
SKU string `bson:"sku,omitempty" json:"sku,omitempty"` | ||
Name string `bson:"name,omitempty" json:"name,omitempty"` | ||
PrevWasteWeight float64 `bson:"prevWasteWeight,omitempty" json:"prevWasteWeight,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line is 92 characters
@@ -95,3 +106,56 @@ func createMongoCollection( | |||
} | |||
return collection, nil | |||
} | |||
|
|||
// createClient creates a MongoDB-Client. | |||
func CreateClient(host []string, username string, password string) (*mongo.Client, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line is 91 characters
} | ||
|
||
//Metric collection | ||
metColl, err := CreateCollection(client, metricCollection, &Metric{}, "metricID", "itemID_metricID_index") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line is 107 characters
TempIn float64 `bson:"tempIn,omitempty" json:"tempIn,omitempty"` | ||
Humidity float64 `bson:"humidity,omitempty" json:"humidity,omitempty"` | ||
Ethylene float64 `bson:"ethylene,omitempty" json:"ethylene,omitempty"` | ||
CarbonDioxide float64 `bson:"carbonDioxide,omitempty" json:"carbonDioxide,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line is 96 characters
@@ -13,7 +13,7 @@ import ( | |||
|
|||
var EthyleneCO2 = func(params graphql.ResolveParams) (interface{}, error) { | |||
rootValue := params.Info.RootValue.(map[string]interface{}) | |||
coll := rootValue["inventoryColl"].(*mongo.Collection) | |||
coll := rootValue["metricColl"].(*mongo.Collection) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error return value is not checked
} | ||
|
||
var Savings = func(params graphql.ResolveParams) (interface{}, error) { | ||
rootValue := params.Info.RootValue.(map[string]interface{}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error return value is not checked
|
||
var Savings = func(params graphql.ResolveParams) (interface{}, error) { | ||
rootValue := params.Info.RootValue.(map[string]interface{}) | ||
coll := rootValue["inventoryColl"].(*mongo.Collection) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error return value is not checked
No description provided.