JuanErnesto
JuanErnesto
PPrisma
Created by JuanErnesto on 12/19/2024 in #help-and-questions
Help creating computed fields
The AI helped:
It appears that creating a computed field using a related field is currently not directly supported in Prisma's result extensions. However, I can provide some information on the current state and limitations of computed fields in Prisma.
As of now, Prisma's result extensions allow you to add computed fields to query results, but these are limited to scalar fields of the model itself. The documentation Result: Add custom fields and methods to query results states:
"You can only create computed fields that are based on scalar fields."
This means that directly using related fields in a computed field is not possible with the current implementation.
There is an open issue on GitHub discussing this limitation: Support relations in result extensions. The issue proposes allowing relation fields in the needs block of result extensions, but this feature is not yet implemented.
For now, you might need to consider alternative approaches, such as:
Fetching the related data separately and computing the field in your application code.
Using a database view if your database supports it.
Exploring other Prisma Client extensions or middleware that might allow for more complex computations.
It's worth noting that this limitation is recognized by the Prisma team, and there are ongoing discussions about how to support computed fields based on relations in the future. You may want to follow the GitHub issue mentioned above for updates on this feature.
I'm sorry I couldn't provide a direct solution to your need. The current limitations of Prisma's computed fields don't allow for using related fields in the computation.
It appears that creating a computed field using a related field is currently not directly supported in Prisma's result extensions. However, I can provide some information on the current state and limitations of computed fields in Prisma.
As of now, Prisma's result extensions allow you to add computed fields to query results, but these are limited to scalar fields of the model itself. The documentation Result: Add custom fields and methods to query results states:
"You can only create computed fields that are based on scalar fields."
This means that directly using related fields in a computed field is not possible with the current implementation.
There is an open issue on GitHub discussing this limitation: Support relations in result extensions. The issue proposes allowing relation fields in the needs block of result extensions, but this feature is not yet implemented.
For now, you might need to consider alternative approaches, such as:
Fetching the related data separately and computing the field in your application code.
Using a database view if your database supports it.
Exploring other Prisma Client extensions or middleware that might allow for more complex computations.
It's worth noting that this limitation is recognized by the Prisma team, and there are ongoing discussions about how to support computed fields based on relations in the future. You may want to follow the GitHub issue mentioned above for updates on this feature.
I'm sorry I couldn't provide a direct solution to your need. The current limitations of Prisma's computed fields don't allow for using related fields in the computation.
4 replies
TtRPC
Created by Peform on 5/10/2024 in #❓-help
uploading image via trpc endpoint
I'm having the same issue, passing the img as a base64 gives me a status code 431 "headers fields too large", any possible solution?
5 replies