storj/satellite/console/consoleweb/consoleql/usercredit.go
Yingrong Zhao 1c2067a090
Create graphql query for getting user credit usage (#2255)
* set up creditUsage query

* rename function name to follow convention

* remove unused code

* add coipyright

* fix linting
2019-06-20 09:09:50 -04:00

37 lines
870 B
Go

// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
package consoleql
import (
"github.com/graphql-go/graphql"
)
const (
// CreditUsageType is a graphql type for user credit
CreditUsageType = "creditUsage"
// FieldAvailableCredit is a field name for available credit
FieldAvailableCredit = "availableCredit"
// FieldUsedCredit is a field name for used credit
FieldUsedCredit = "usedCredit"
// FieldReferred is a field name for total referred number
FieldReferred = "referred"
)
func graphqlCreditUsage() *graphql.Object {
return graphql.NewObject(graphql.ObjectConfig{
Name: CreditUsageType,
Fields: graphql.Fields{
FieldAvailableCredit: &graphql.Field{
Type: graphql.Int,
},
FieldUsedCredit: &graphql.Field{
Type: graphql.Int,
},
FieldReferred: &graphql.Field{
Type: graphql.Int,
},
},
})
}