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

Is there a way to ignore a "*_id" field? #33

Open
zhao-ji opened this issue Apr 17, 2020 · 1 comment
Open

Is there a way to ignore a "*_id" field? #33

zhao-ji opened this issue Apr 17, 2020 · 1 comment

Comments

@zhao-ji
Copy link

zhao-ji commented Apr 17, 2020

Basically, I have table field ends with "_id", but there is no table related to that field. So is there any way to not parsing that field please? Currently what I can only do is rename that field.

Error message is below:

(node:724) UnhandledPromiseRejectionWarning: Error: Model with tweets does not exist
    at findModelKey (node_modules/tuql/dist/utils/index.js:57:9)
    at node_modules/tuql/dist/builders/schema.js:107:47
    at Array.forEach (<anonymous>)
    at node_modules/tuql/dist/builders/schema.js:100:18
(node:724) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:724) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Thanks for your work!

@tddpirate
Copy link

Let's generalize a bit.
I would like tuql to also be able also to ignore some tables and make them inaccessible via GraphQL, for example due to security reasons.

So let's define a configuration file format, which will allow the user to tell tuql to subject tables and fields to special handling.
An example of what I have in mind (syntax being similar to that of CSS):

django_admin_log.object_id { // Special handling of a table field.
    foreignkey: false;  // Do not look for a table named object or objects.
    rename: object_notid; // Rename the field name as far as the GraphQL schema is concerned.
}
django_migrations,auth_user_groups.auth_user { // Special handling of a table and a table field.
    access: readonly;
}
django_content_type,auth_group,auth_user { // Special handling of tables.
    access: none; // hide those tables
}

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

No branches or pull requests

2 participants