Hi, first and foremost "Thank you"
Thanks to your tutorial i have been able to start a personal project using :
- NextJS
- Chakra UI
- Prisma
- Nexus
- Apollo
- Sqlite
All of which are new to me.
I'm a beginner in the database/ORM/GraphQL world
I have been stuck a bit on an issue lately
"How to use DateTime inside Nexus ?"
To explain a bit, following/adapting your tutorial i did this
// graphql/types/recipe.ts
export const Recipe = objectType({
name: 'Recipe',
definition(t) {
t.string('id')
t.string('name')
t.string('description')
t.string('url')
t.string('category')
t.string('createdAt') // Not the good Type (should be a "DateTime")
t.string('updatedAt') // Not the good Type (should be a "DateTime")
},
})
But i had seated "this" inside schema.prisma
// schema.prisma
model Recipe {
id String @id @unique
name String
description String
url String
category String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
Finally i had a Typescript error on a query "resolver". I took a bit of time to found that error.
Copy past are evil
From my understanding , nexus doesn't support "DateTime" natively
In order to implement DateTime type you need to setup some complexe "mapping" inside the makeSchema method (could you point me on the documentation ?)
Or use nexus-prisma in order to make prisma and nexus communicate about the types.
Is there another way? I am missing something else ?
If you're close to the team developing nexus-prisma tell them i'm waiting for this plugin π
Thanks you again
You're helping me becoming a better developer