storj/satellite/console/consoleweb/consoleql/schema.go
Yehor Butko 3e2c101bd8
V3-1152 Node bootstrap web backend (#1327)
* V3-1152 Node bootstrap
2019-03-05 12:38:21 +02:00

32 lines
731 B
Go

// Copyright (C) 2018 Storj Labs, Inc.
// See LICENSE for copying information.
package consoleql
import (
"github.com/graphql-go/graphql"
"storj.io/storj/internal/storjql"
"storj.io/storj/satellite/console"
"storj.io/storj/satellite/mailservice"
)
// CreateSchema creates a schema for satellites console graphql api
func CreateSchema(service *console.Service, mailService *mailservice.Service) (schema graphql.Schema, err error) {
storjql.WithLock(func() {
creator := TypeCreator{}
err = creator.Create(service, mailService)
if err != nil {
return
}
schema, err = graphql.NewSchema(graphql.SchemaConfig{
Query: creator.RootQuery(),
Mutation: creator.RootMutation(),
})
})
return schema, err
}