If you want to customize your schema, you can use entities
object to build your own new schema
import { createServer } from 'node:http'
import { GraphQLList, GraphQLNonNull, GraphQLObjectType, GraphQLSchema } from 'graphql'
import { createYoga } from 'graphql-yoga'
import { buildSchema } from 'drizzle-graphql'
import { db } from './database'
const { entities } = buildSchema(db)
const schema = new GraphQLSchema({
query: new GraphQLObjectType({
name: 'Query',
fields: {
users: entities.queries.users,
customer: entities.queries.customersSingle,
customUsers: {
type: new GraphQLList(new GraphQLNonNull(entities.types.UsersItem)),
args: {
where: {
type: entities.inputs.UsersFilters
}
},
resolve: async (source, args, context, info) => {
const result = await db.select(schema.Users).where()...
return result
}
}
}
}),
mutation: new GraphQLObjectType({
name: 'Mutation',
fields: entities.mutations
}),
types: [...Object.values(entities.types), ...Object.values(entities.inputs)]
})
const yoga = createYoga({
schema
})
server.listen(4000, () => {
console.info('Server is running on http://localhost:4000/graphql')
})