Skip to content
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

Merged
merged 1 commit into from
Nov 22, 2018
Merged

Implemented reports query #1

merged 1 commit into from
Nov 22, 2018

Conversation

Jaskaranbir
Copy link
Member

No description provided.


// genericQuery is a generic-resolver for Inventory GraphQL-query.
// Other queries call this function.
var genericQuery = func(serviceAction string, params graphql.ResolveParams) (interface{}, error) {

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

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"`

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) {

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")

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"`

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)

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{})

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)

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

@Jaskaranbir Jaskaranbir merged commit 4fd2db3 into release-candidate Nov 22, 2018
@bors bors bot deleted the impl-reports branch November 22, 2018 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants