Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support a joined field in sqlDeps #398

Open
lorensr opened this issue Jan 23, 2020 · 0 comments
Open

Support a joined field in sqlDeps #398

lorensr opened this issue Jan 23, 2020 · 0 comments

Comments

@lorensr
Copy link
Member

lorensr commented Jan 23, 2020

Querying for Post.description currently gives an error saying there's no such column posts.author (which is true—there's only an posts.author_id).

    Post: {
      sqlTable: 'posts',
      uniqueKey: 'id',
      fields: {
        author: {
          sqlJoin: (postTable, userTable) =>
            `${postTable}.author_id = ${userTable}.id`
        },
        title: { sqlColumn: 'title' },
        description: { sqlDeps: ['title', 'author'] },

Further, would be nice to be able to do sqlDeps: ['title', 'author.first_name', 'author.last_name']

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant