Skip to content

Nexus objectType what is equivalent in Pothos Prisma Plugin #1001

Closed Answered by hayes
ccfiel asked this question in Q&A
Discussion options

You must be logged in to vote

The closest direct comparison would be the simple-objects plugin, which was designed for exactly the pattern you are describing coming from nexus: https://pothos-graphql.dev/docs/plugins/simple-objects

What I'd actually recommend though is using builder.objectRef: https://pothos-graphql.dev/docs/guide/objects#using-refs

import { AnalyticsCashBalances } from '@prisma/client';

export const AnalyticsCashBalances = builder.objectRef<AnalyticsCashBalances>('AnalyticsCashBalances')

AnalyticsCashBalances.implement({
  fields: (t) =>  ({
    amount: t.exposeString('amount'),
    balance: t.exposeString('balance'),
    comment: t.exposeString('comment'),
    createdAt: t.expose('createdAt', {

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by hayes
Comment options

You must be logged in to vote
4 replies
@hayes
Comment options

@ccfiel
Comment options

@hayes
Comment options

@ccfiel
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1000 on August 31, 2023 23:57.