package graph import ( "git.aiterp.net/stufflog/server/graph/graphcore" "git.aiterp.net/stufflog/server/graph/resolvers" "git.aiterp.net/stufflog/server/services" "github.com/99designs/gqlgen/graphql" "github.com/99designs/gqlgen/graphql/handler" "github.com/gin-gonic/gin" ) //go:generate go run github.com/99designs/gqlgen --verbose --config gqlgen.yml // New creates a new GraphQL schema. func New(s services.Bundle) graphql.ExecutableSchema { return graphcore.NewExecutableSchema(graphcore.Config{ Resolvers: &resolvers.Resolver{S: s}, }) } func Gin(s services.Bundle) gin.HandlerFunc { schema := New(s) gqlHandler := handler.NewDefaultServer(schema) return func(c *gin.Context) { s.Auth.CheckGinSession(c) gqlHandler.ServeHTTP(c.Writer, c.Request) } }