GetPayload: Make all properties optional on related model
I'm struggling to find a clean way to use the the
For a specific helper function, we attempt to compute a status based on the number of entries in a related 1:M relationship. We do not care which fields are included in the array of related objects, just that the array itself exists. I've included several examples below using a standard users->posts relationship to demonstrate the issue. In each case below, all fields are required.
Can someone share insight on how they've properly typed in these situations while using the Prisma Typescript helper functions? I'd rather not create the type by hand for multiple reasons but that seems to be the only way unfortunately
GetPayload model helper functions with nested relationships without some level of properties being required. We use helper functions to compute dynamic data points (status', counts, etc). For a specific helper function, we attempt to compute a status based on the number of entries in a related 1:M relationship. We do not care which fields are included in the array of related objects, just that the array itself exists. I've included several examples below using a standard users->posts relationship to demonstrate the issue. In each case below, all fields are required.
Can someone share insight on how they've properly typed in these situations while using the Prisma Typescript helper functions? I'd rather not create the type by hand for multiple reasons but that seems to be the only way unfortunately