We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import { MongOrb, QuestionModel } from '@/src/orm.js'; import { createResolvers } from '@/src/axolotl.js'; export const Question = createResolvers({ Question:{ user: async ([source]) => { const questionSource = source as QuestionModel return MongOrb("User").collection.findOne({ username: questionSource.user }) } }, });
Normally we just import the type from some ORM and cast the type of source. But we can do better.
import { MongOrb, QuestionModel } from '@/src/orm.js'; import { createResolvers, fromSource } from '@/src/axolotl.js'; import { Query } from '@/src/axolotl.js'; export const Question = createResolvers({ Question: fromSource(Query.questionById)({ user: async ([source]) => { return MongOrb("User").collection.findOne({ // source is already typed username: source.user }) } }), });
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Normally we just import the type from some ORM and cast the type of source. But we can do better.
The text was updated successfully, but these errors were encountered: