Bug reports: node.js generator

Bug reports: node.js generator

990consulting990consulting Posts: 23Questions: 7Answers: 0

I got an error message when I posted this as a discussion, and then I didn't see it on the post list. Apologies if it's a double post.

There were a few typos in the code that came out of the generator for node.js. I was able to work my way through them, but I thought you'd want to know. I used the generator to create a table called "efile_schemas." The following issues pertain to a date field.

(1) In server/table.efile_schemas.js, the validator object was called "Validation," but in the destructuring call, it was called "Validate," resulting in an error.

(2) When I fixed that typo, I got the following error:

stack: ReferenceError: YYYY is not defined
    at /home/www/mappings/server/table.efile_schema.js:31:42
    at Layer.handle [as handle_request] (/home/www/mappings/node_modules/express/lib/router/layer.js:95:5)
    at next (/home/www/mappings/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/home/www/mappings/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/home/www/mappings/node_modules/express/lib/router/layer.js:95:5)
    at /home/www/mappings/node_modules/express/lib/router/index.js:281:22
    at Function.process_params (/home/www/mappings/node_modules/express/lib/router/index.js:335:12)
    at next (/home/www/mappings/node_modules/express/lib/router/index.js:275:10)
    at Function.handle (/home/www/mappings/node_modules/express/lib/router/index.js:174:3)
    at router (/home/www/mappings/node_modules/express/lib/router/index.js:47:12)
    at Layer.handle [as handle_request] (/home/www/mappings/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/home/www/mappings/node_modules/express/lib/router/index.js:317:13)
    at /home/www/mappings/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/home/www/mappings/node_modules/express/lib/router/index.js:335:12)
    at next (/home/www/mappings/node_modules/express/lib/router/index.js:275:10)
    at app.use (/home/www/mappings/node_modules/express-busboy/index.js:66:20)

This appeared to be caused by a bare literal YYYY-MM-DD supplied to the validator, rather than a quoted string.

(3) I fixed that, and then I got this one:

stack: TypeError: Format.dateSqlToFormat is not a function
    at /home/www/mappings/server/table.efile_schema.js:24:32
    at Layer.handle [as handle_request] (/home/www/mappings/node_modules/express/lib/router/layer.js:95:5)
    at next (/home/www/mappings/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/home/www/mappings/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/home/www/mappings/node_modules/express/lib/router/layer.js:95:5)
    at /home/www/mappings/node_modules/express/lib/router/index.js:281:22
    at Function.process_params (/home/www/mappings/node_modules/express/lib/router/index.js:335:12)
    at next (/home/www/mappings/node_modules/express/lib/router/index.js:275:10)
    at Function.handle (/home/www/mappings/node_modules/express/lib/router/index.js:174:3)
    at router (/home/www/mappings/node_modules/express/lib/router/index.js:47:12)
    at Layer.handle [as handle_request] (/home/www/mappings/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/home/www/mappings/node_modules/express/lib/router/index.js:317:13)
    at /home/www/mappings/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/home/www/mappings/node_modules/express/lib/router/index.js:335:12)
    at next (/home/www/mappings/node_modules/express/lib/router/index.js:275:10)
    at app.use (/home/www/mappings/node_modules/express-busboy/index.js:66:20)

Upon inspecting node_modules/datatables.net-editor-server/dist/formatters.js, I found that the functions were
named differently from what came out of the generator.

dateSqlToFormat ==> sqlDateToFormat
dateFormatToSql ==> formatSqlToDate

Having fixed those typos, everything worked as expected. Now, to start building. I'll let you know if I come across any likely bugs. Hopefully I've saved up enough brownie points now that, if something is my mistake, you won't be too mad at me... :)

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 62,338Questions: 1Answers: 10,228 Site admin
    Answer ✓

    Thank you! All three points resolved and deployed now :).

    Allan

This discussion has been closed.