bradleyboy/tuql

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

zhao-ji opened this issue · 1 comments

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!

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
}