2019-03-05 10:38:21 +00:00
|
|
|
// Copyright (C) 2018 Storj Labs, Inc.
|
2019-02-05 19:44:00 +00:00
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
package consoleql
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/graphql-go/graphql"
|
2019-03-26 15:56:16 +00:00
|
|
|
"go.uber.org/zap"
|
2019-02-05 19:44:00 +00:00
|
|
|
|
|
|
|
"storj.io/storj/satellite/console"
|
2019-03-02 15:22:20 +00:00
|
|
|
"storj.io/storj/satellite/mailservice"
|
2019-02-05 19:44:00 +00:00
|
|
|
)
|
|
|
|
|
2020-07-16 15:18:02 +01:00
|
|
|
// CreateSchema creates a schema for satellites console graphql api.
|
2019-03-26 15:56:16 +00:00
|
|
|
func CreateSchema(log *zap.Logger, service *console.Service, mailService *mailservice.Service) (schema graphql.Schema, err error) {
|
2019-04-04 15:56:20 +01:00
|
|
|
creator := TypeCreator{}
|
2019-02-05 19:44:00 +00:00
|
|
|
|
2019-04-04 15:56:20 +01:00
|
|
|
err = creator.Create(log, service, mailService)
|
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
}
|
2019-02-05 19:44:00 +00:00
|
|
|
|
2019-04-04 15:56:20 +01:00
|
|
|
return graphql.NewSchema(graphql.SchemaConfig{
|
|
|
|
Query: creator.RootQuery(),
|
|
|
|
Mutation: creator.RootMutation(),
|
2019-02-05 19:44:00 +00:00
|
|
|
})
|
|
|
|
}
|