Closed saphewilliam closed 2 years ago
Still TODO: I think we should expose all object fields as their own objects aswell, which would allow for easy field modification
Current situation:
export const UserObject = definePrismaObject('User', {
description: undefined,
findUnique: ({ id }) => ({ id }),
fields: (t) => ({
id: t.exposeID('id', { description: '@Pothos.omit(create, update)', nullable: false }),
createdAt: t.field({
type: Inputs.DateTime,
description: '@Pothos.omit(create, update)',
nullable: false,
resolve: (parent) => parent.createdAt,
}),
}),
});
Desired situation:
export const UserIdField = defineIdField({
description: '@Pothos.omit(create, update)',
nullable: false
});
export const UserCreatedAtField = defineField({
type: Inputs.DateTime,
description: '@Pothos.omit(create, update)',
nullable: false,
resolve: (parent) => parent.createdAt,
});
export const UserObject = definePrismaObject('User', {
description: undefined,
findUnique: ({ id }) => ({ id }),
fields: (t) => ({
id: t.exposeID('id', UserIdField),
createdAt: t.field(UserCreatedAtField),
}),
});
Still TODO: I think we should expose all object fields as their own objects aswell, which would allow for easy field modification.
This is now resolved and added to documentation! IMO it's ready for review and merge.
Hi @saphewilliam I'm really happy to see the improvements you've made here.
I tested it a few days ago, and I didn't have time to formulate a message about the improvements I was going to suggest. But you already made them
This is the second of two Pull Requests (previous: #6) implementing the desired nexus-prisma-like feature set as discussed in #4
This PR contains:
This PR does not contain: