-
I'm trying to allow a prismaUpdate Input field to accept the atomic number operators Prisma supports. It seems this isn't supported by the plugin, so I've been trying to build the appropriate inputRef myself, but am struggling. I've gathered that the shape expected by the views field on RouteUpdateInput is not correct. But I'm not sure how to alter that, or if I need to create that update input myself, without the plugin. I'm sure this is something super basic and that my attempt here reveals my ignorance to working with types on this level. I'm new to this in general, so I'm struggling to fully understand how this library works at it's core. Any hints or suggestions here would be appreciated. Here is the code I think is relevant: builder.prismaObject("Route", {
fields: (t) => ({
id: t.exposeID("id"),
author: t.relation("author", { nullable: true }),
authorID: t.exposeID("authorID", { nullable: true }),
name: t.exposeString("name"),
type: t.expose("type", { type: routeType, nullable: true }),
attribution: t.expose("attribution", { type: "URL", nullable: true }),
originalUpload: t.relation("originalUpload", { nullable: true }),
lineStringGeoJSON: t.expose("lineStringGeoJSON", {
type: "LineString",
nullable: true,
}),
waypointsGeoJSON: t.expose("waypointsGeoJSON", {
type: ["GeoJsonPoint"],
nullable: true,
}),
length: t.exposeInt("length", { nullable: true }),
highPoint: t.exposeInt("highPoint", { nullable: true }),
ascent: t.exposeInt("ascent", { nullable: true }),
descent: t.exposeInt("descent", { nullable: true }),
views: t.exposeInt("views"),
updated: t.expose("updatedAt", { type: "DateTime" }),
created: t.expose("createdAt", { type: "DateTime" }),
}),
});
const RouteUpdateInput = builder.prismaUpdate("Route", {
name: "RouteUpdateInput",
fields: () => ({
name: "String",
attribution: "String",
author: UserRelateToOneForUpdateInput,
type: routeType,
lineStringGeoJSON: "JSONobj",
length: "Int",
highPoint: "Int",
ascent: "Int",
descent: "Int",
views: RouteIntFieldUpdateOperationsInput,
}),
});
const RouteIntFieldUpdateOperationsInput: PothosSchemaTypes.InputObjectRef<Prisma.IntFieldUpdateOperationsInput> =
builder.inputType("RouteIntFieldUpdateOperationsInput", {
fields: (t) => ({
increment: t.int({ required: true }),
decrement: t.int({ required: true }),
}),
}); More |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
just published a new version with a helper for creating update objects with atomic int operations |
Beta Was this translation helpful? Give feedback.
just published a new version with a helper for creating update objects with atomic int operations