Is this the way to include / join a table?
I'm extending Doc<"organizationCourses"> into an interface OrganizationCourse that includes course.
2 Replies
looks good to me! you could get better type inference by doing a
.map
instead of a .forEach
, which might mean you don't need to define an interface because the type will be inferredIf you're returning a paginated result to use with the
usePaginatedQuery
, it needs to conform to PaginationResult
which has these fields:
These are the fields in organizationCourses
so instead of returning {data: organizationCourses, error: null}
you'd need to return something like:
{ ...organizationCourses, error: null}
but I'm not sure how to read the error, without having a custom equivalent to usePaginatedQuery
or passing it in page
somehow..
Are you usig usePaginatedQuery
?