TTC
Theo's Typesafe Cult.majamin
Matching types to Prisma models
I have a T3 boilerplate with Prisma and PlanetScale as per Theo's T3 Stack Tutorial. I'm trying to create a dynamic route for a product under /shop that will accept a router query of the product ID. What is the best practice in this environment to create a type for a product, but using the already-existing model in the prisma schema? I could just create my own type, of course, but then that seems like it's a duplication of effort (creating the prisma model AND the type, and having to update both). Any advice would be great. Thank you
Solution:
You can just import the model type from prisma like where you have a prisma model named "Product"
O
oadster•377d ago
Why don't you just use the type from prisma?
Solution
O
oadster•377d ago
You can just import the model type from prisma like where you have a prisma model named "Product"
M
.majamin•377d ago
Thanks, that's exactly it. This is my first time using Prisma, and I'm glad there's a way to do this so easily.
21KMembers
View on DiscordWant results from more Discord servers?
More Postsneed key value pair database like redisneed key value pair datastore like redis which is similar to python dictionary and should be cleint How do I solve this errorI have installed daisyui already. Already tried the suggested fix"Unsafe assignment of `any` valueI am using latest create-t3-app with prisma, tailwind nextAuth and trpcClerk + Next.js app router <SignedOut> children not rendered after <UserButton> sign outHi there! I'm currently building an app with Clerk and I've got signing in working however when I siturbo repo built lint errorI was setting up ct3turbo when I saw the GitHub action workflow is showing errors, how do I fix it?changing col-span with template literalany idea why this isnt working?[Solved] T3 Stack PWA ??Does anybody know how to turn a t3 site into a PWA? I am using next-pwa but I am getting a few errortRPC Error: Invalid hook call.Sorry for the noob question I just cant figure out how to do this I have the following tRPC route:
eStack?Hey how would I go about creating a website where you can post minecraft servers and include a imageHow would I order by the role?Hello, I'm trying to set up an API, where I return some users. I've got it working, where it returnsPrisma Create with Connect IssueHey!
I wasn't able to find another thread explaining this, but I'd love help with this!
I have twoGenerating image background jobI'm making a game where you can create levels in HTML5 Canvas and upload them to the api. I will nee