Hello,
I have a little problem creating a new user.
I think it comes from the fact that it does not create my user in userdatas in addition to users.
The user is well registered in users but not in usersdatas
Here is my error:
[nodemon] restarting due to changes...
[nodemon] starting `node ./server.js localhost 3310`
Your admin panel is available here: https://app.forestadmin.com/projects
Your application is listening on port 3310.
OPTIONS /forest/users?fields%5Bcompagny%5D=name&fields%5BusersData%5D=fullName&fields%5Busers%5D=userId%2CusersData%2Cgender%2Cemail%2Ccompagny%2CfullNumber%2CemailValidated%2CcreatedAt&page%5Bnumber%5D=1&page%5Bsize%5D=15&searchExtended=0&sort=-createdAt&timezone=Europe%2FParis 204 0 - 7.702 ms
OPTIONS /forest/users/count?fields%5Busers%5D=userId%2CusersData%2Cgender%2Cemail%2Ccompagny%2CfullNumber%2CemailValidated%2CcreatedAt&fields%5BusersData%5D=fullName&fields%5Bcompagny%5D=name&searchExtended=0&timezone=Europe%2FParis 204 0 - 0.342 ms
GET /forest/users/count?fields%5Busers%5D=userId%2CusersData%2Cgender%2Cemail%2Ccompagny%2CfullNumber%2CemailValidated%2CcreatedAt&fields%5BusersData%5D=fullName&fields%5Bcompagny%5D=name&searchExtended=0&timezone=Europe%2FParis 304 - - 709.088 ms
GET /forest/users?fields%5Bcompagny%5D=name&fields%5BusersData%5D=fullName&fields%5Busers%5D=userId%2CusersData%2Cgender%2Cemail%2Ccompagny%2CfullNumber%2CemailValidated%2CcreatedAt&page%5Bnumber%5D=1&page%5Bsize%5D=15&searchExtended=0&sort=-createdAt&timezone=Europe%2FParis 304 - - 909.343 ms
OPTIONS /forest/compagnies?context%5Brecord%5D%5Btype%5D=user&context%5Brecord%5D%5Bid%5D=&fields%5Bcompagnies%5D=name&page%5Bnumber%5D=1&page%5Bsize%5D=100&searchToEdit=true&timezone=Europe%2FParis 204 0 - 0.151 ms
GET /forest/compagnies?context%5Brecord%5D%5Btype%5D=user&context%5Brecord%5D%5Bid%5D=&fields%5Bcompagnies%5D=name&page%5Bnumber%5D=1&page%5Bsize%5D=100&searchToEdit=true&timezone=Europe%2FParis 304 - - 74.876 ms
GET /forest/compagnies?context%5Brecord%5D%5Btype%5D=user&context%5Brecord%5D%5Bid%5D=&fields%5Bcompagnies%5D=name&page%5Bnumber%5D=1&page%5Bsize%5D=100&searchToEdit=true&timezone=Europe%2FParis 304 - - 43.649 ms
Unhandled rejection Error: WHERE parameter "userId" has invalid "undefined" value
at MySQLQueryGenerator.whereItemQuery (/Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/dialects/abstract/query-generator.js:2085:13)
at /Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/dialects/abstract/query-generator.js:2074:25
at Array.forEach (<anonymous>)
at MySQLQueryGenerator.whereItemsQuery (/Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/dialects/abstract/query-generator.js:2072:35)
at MySQLQueryGenerator.getWhereConditions (/Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/dialects/abstract/query-generator.js:2484:19)
at MySQLQueryGenerator.selectQuery (/Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/dialects/abstract/query-generator.js:1307:28)
at QueryInterface.select (/Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/query-interface.js:1119:27)
at /Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/model.js:1754:34
at tryCatcher (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/promise.js:547:31)
at Promise._settlePromise (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromise0 (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/promise.js:649:10)
at Promise._settlePromises (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/promise.js:729:18)
at _drainQueueStep (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/async.js:93:12)
at _drainQueue (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/async.js:86:9)
at Async._drainQueues (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/async.js:15:14)
at processImmediate (internal/timers.js:456:21)
Unhandled rejection Error: WHERE parameter "userId" has invalid "undefined" value
at MySQLQueryGenerator.whereItemQuery (/Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/dialects/abstract/query-generator.js:2085:13)
at /Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/dialects/abstract/query-generator.js:2074:25
at Array.forEach (<anonymous>)
at MySQLQueryGenerator.whereItemsQuery (/Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/dialects/abstract/query-generator.js:2072:35)
at MySQLQueryGenerator.whereQuery (/Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/dialects/abstract/query-generator.js:2045:24)
at MySQLQueryGenerator.updateQuery (/Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/dialects/abstract/query-generator.js:435:116)
at QueryInterface.bulkUpdate (/Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/query-interface.js:1038:37)
at /Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/model.js:3219:34
at tryCatcher (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/promise.js:547:31)
at Promise._settlePromise (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromise0 (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/promise.js:649:10)
at Promise._settlePromises (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/promise.js:729:18)
at _drainQueueStep (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/async.js:93:12)
at _drainQueue (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/async.js:86:9)
at Async._drainQueues (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/async.js:15:14)
at processImmediate (internal/timers.js:456:21)
Unhandled rejection Error: WHERE parameter "userId" has invalid "undefined" value
at MySQLQueryGenerator.whereItemQuery (/Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/dialects/abstract/query-generator.js:2085:13)
at /Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/dialects/abstract/query-generator.js:2074:25
at Array.forEach (<anonymous>)
at MySQLQueryGenerator.whereItemsQuery (/Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/dialects/abstract/query-generator.js:2072:35)
at MySQLQueryGenerator.whereQuery (/Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/dialects/abstract/query-generator.js:2045:24)
at MySQLQueryGenerator.updateQuery (/Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/dialects/abstract/query-generator.js:435:116)
at QueryInterface.bulkUpdate (/Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/query-interface.js:1038:37)
at /Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/model.js:3219:34
at tryCatcher (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/promise.js:547:31)
at Promise._settlePromise (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromise0 (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/promise.js:649:10)
at Promise._settlePromises (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/promise.js:729:18)
at _drainQueueStep (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/async.js:93:12)
at _drainQueue (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/async.js:86:9)
at Async._drainQueues (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/async.js:15:14)
at processImmediate (internal/timers.js:456:21)
Unhandled rejection Error: WHERE parameter "userId" has invalid "undefined" value
at MySQLQueryGenerator.whereItemQuery (/Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/dialects/abstract/query-generator.js:2085:13)
at /Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/dialects/abstract/query-generator.js:2074:25
at Array.forEach (<anonymous>)
at MySQLQueryGenerator.whereItemsQuery (/Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/dialects/abstract/query-generator.js:2072:35)
at MySQLQueryGenerator.whereQuery (/Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/dialects/abstract/query-generator.js:2045:24)
at MySQLQueryGenerator.updateQuery (/Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/dialects/abstract/query-generator.js:435:116)
at QueryInterface.bulkUpdate (/Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/query-interface.js:1038:37)
at /Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/model.js:3219:34
at tryCatcher (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/promise.js:547:31)
at Promise._settlePromise (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromise0 (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/promise.js:649:10)
at Promise._settlePromises (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/promise.js:729:18)
at _drainQueueStep (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/async.js:93:12)
at _drainQueue (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/async.js:86:9)
at Async._drainQueues (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/async.js:15:14)
at processImmediate (internal/timers.js:456:21)
Unhandled rejection Error: WHERE parameter "userId" has invalid "undefined" value
at MySQLQueryGenerator.whereItemQuery (/Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/dialects/abstract/query-generator.js:2085:13)
at /Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/dialects/abstract/query-generator.js:2074:25
at Array.forEach (<anonymous>)
at MySQLQueryGenerator.whereItemsQuery (/Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/dialects/abstract/query-generator.js:2072:35)
at MySQLQueryGenerator.whereQuery (/Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/dialects/abstract/query-generator.js:2045:24)
at MySQLQueryGenerator.updateQuery (/Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/dialects/abstract/query-generator.js:435:116)
at QueryInterface.bulkUpdate (/Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/query-interface.js:1038:37)
at /Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/model.js:3219:34
at tryCatcher (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/promise.js:547:31)
at Promise._settlePromise (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromise0 (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/promise.js:649:10)
at Promise._settlePromises (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/promise.js:729:18)
at _drainQueueStep (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/async.js:93:12)
at _drainQueue (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/async.js:86:9)
at Async._drainQueues (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/async.js:15:14)
at processImmediate (internal/timers.js:456:21)
Unhandled rejection Error: WHERE parameter "userId" has invalid "undefined" value
at MySQLQueryGenerator.whereItemQuery (/Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/dialects/abstract/query-generator.js:2085:13)
at /Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/dialects/abstract/query-generator.js:2074:25
at Array.forEach (<anonymous>)
at MySQLQueryGenerator.whereItemsQuery (/Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/dialects/abstract/query-generator.js:2072:35)
at MySQLQueryGenerator.whereQuery (/Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/dialects/abstract/query-generator.js:2045:24)
at MySQLQueryGenerator.updateQuery (/Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/dialects/abstract/query-generator.js:435:116)
at QueryInterface.bulkUpdate (/Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/query-interface.js:1038:37)
at /Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/model.js:3219:34
at tryCatcher (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/promise.js:547:31)
at Promise._settlePromise (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromise0 (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/promise.js:649:10)
at Promise._settlePromises (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/promise.js:729:18)
at _drainQueueStep (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/async.js:93:12)
at _drainQueue (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/async.js:86:9)
at Async._drainQueues (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/async.js:15:14)
at processImmediate (internal/timers.js:456:21)
Unhandled rejection Error: WHERE parameter "userId" has invalid "undefined" value
at MySQLQueryGenerator.whereItemQuery (/Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/dialects/abstract/query-generator.js:2085:13)
at /Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/dialects/abstract/query-generator.js:2074:25
at Array.forEach (<anonymous>)
at MySQLQueryGenerator.whereItemsQuery (/Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/dialects/abstract/query-generator.js:2072:35)
at MySQLQueryGenerator.whereQuery (/Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/dialects/abstract/query-generator.js:2045:24)
at MySQLQueryGenerator.updateQuery (/Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/dialects/abstract/query-generator.js:435:116)
at QueryInterface.bulkUpdate (/Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/query-interface.js:1038:37)
at /Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/model.js:3219:34
at tryCatcher (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/promise.js:547:31)
at Promise._settlePromise (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromise0 (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/promise.js:649:10)
at Promise._settlePromises (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/promise.js:729:18)
at _drainQueueStep (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/async.js:93:12)
at _drainQueue (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/async.js:86:9)
at Async._drainQueues (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/async.js:15:14)
at processImmediate (internal/timers.js:456:21)
Unhandled rejection Error: WHERE parameter "userId" has invalid "undefined" value
at MySQLQueryGenerator.whereItemQuery (/Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/dialects/abstract/query-generator.js:2085:13)
at /Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/dialects/abstract/query-generator.js:2074:25
at Array.forEach (<anonymous>)
at MySQLQueryGenerator.whereItemsQuery (/Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/dialects/abstract/query-generator.js:2072:35)
at MySQLQueryGenerator.whereQuery (/Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/dialects/abstract/query-generator.js:2045:24)
at MySQLQueryGenerator.updateQuery (/Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/dialects/abstract/query-generator.js:435:116)
at QueryInterface.bulkUpdate (/Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/query-interface.js:1038:37)
at /Users/bvelluet/Git/Alfred/node_modules/sequelize/lib/model.js:3219:34
at tryCatcher (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/promise.js:547:31)
at Promise._settlePromise (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromise0 (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/promise.js:649:10)
at Promise._settlePromises (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/promise.js:729:18)
at _drainQueueStep (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/async.js:93:12)
at _drainQueue (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/async.js:86:9)
at Async._drainQueues (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (/Users/bvelluet/Git/Alfred/node_modules/sequelize/node_modules/bluebird/js/release/async.js:15:14)
at processImmediate (internal/timers.js:456:21)
POST /forest/users 200 1537 - 127.705 ms
OPTIONS /forest/users/31 204 0 - 1.315 ms
GET /forest/users/31 200 1537 - 17.296 ms
GET /forest/users?fields%5Bcompagny%5D=name&fields%5BusersData%5D=fullName&fields%5Busers%5D=userId%2CusersData%2Cgender%2Cemail%2Ccompagny%2CfullNumber%2CemailValidated%2CcreatedAt&page%5Bnumber%5D=1&page%5Bsize%5D=15&searchExtended=0&sort=-createdAt&timezone=Europe%2FParis 200 3461 - 210.322 ms
GET /forest/users/count?fields%5Busers%5D=userId%2CusersData%2Cgender%2Cemail%2Ccompagny%2CfullNumber%2CemailValidated%2CcreatedAt&fields%5BusersData%5D=fullName&fields%5Bcompagny%5D=name&searchExtended=0&timezone=Europe%2FParis 200 11 - 108.123 ms
GET /forest/users/count?fields%5Busers%5D=userId%2CusersData%2Cgender%2Cemail%2Ccompagny%2CfullNumber%2CemailValidated%2CcreatedAt&fields%5BusersData%5D=fullName&fields%5Bcompagny%5D=name&searchExtended=0&timezone=Europe%2FParis 200 11 - 98.083 ms
GET /forest/users/count?fields%5Busers%5D=userId%2CusersData%2Cgender%2Cemail%2Ccompagny%2CfullNumber%2CemailValidated%2CcreatedAt&fields%5BusersData%5D=fullName&fields%5Bcompagny%5D=name&searchExtended=0&timezone=Europe%2FParis 200 11 - 103.298 ms
GET /forest/users/count?fields%5Busers%5D=userId%2CusersData%2Cgender%2Cemail%2Ccompagny%2CfullNumber%2CemailValidated%2CcreatedAt&fields%5BusersData%5D=fullName&fields%5Bcompagny%5D=name&searchExtended=0&timezone=Europe%2FParis 200 11 - 304.366 ms
GET /forest/users/count?fields%5Busers%5D=userId%2CusersData%2Cgender%2Cemail%2Ccompagny%2CfullNumber%2CemailValidated%2CcreatedAt&fields%5BusersData%5D=fullName&fields%5Bcompagny%5D=name&searchExtended=0&timezone=Europe%2FParis 200 11 - 305.641 ms
GET /forest/users/count?fields%5Busers%5D=userId%2CusersData%2Cgender%2Cemail%2Ccompagny%2CfullNumber%2CemailValidated%2CcreatedAt&fields%5BusersData%5D=fullName&fields%5Bcompagny%5D=name&searchExtended=0&timezone=Europe%2FParis 200 11 - 265.395 ms
GET /forest/users/count?fields%5Busers%5D=userId%2CusersData%2Cgender%2Cemail%2Ccompagny%2CfullNumber%2CemailValidated%2CcreatedAt&fields%5BusersData%5D=fullName&fields%5Bcompagny%5D=name&searchExtended=0&timezone=Europe%2FParis 200 11 - 265.257 ms
GET /forest/users/count?fields%5Busers%5D=userId%2CusersData%2Cgender%2Cemail%2Ccompagny%2CfullNumber%2CemailValidated%2CcreatedAt&fields%5BusersData%5D=fullName&fields%5Bcompagny%5D=name&searchExtended=0&timezone=Europe%2FParis 200 11 - 268.513 ms
GET /forest/users/count?fields%5Busers%5D=userId%2CusersData%2Cgender%2Cemail%2Ccompagny%2CfullNumber%2CemailValidated%2CcreatedAt&fields%5BusersData%5D=fullName&fields%5Bcompagny%5D=name&searchExtended=0&timezone=Europe%2FParis 200 11 - 268.079 ms
Here are my models:
users.js
// This model was generated by Lumber. However, you remain in control of your models.
// Learn how here: https://docs.forestadmin.com/documentation/v/v5/reference-guide/models/enrich-your-models
module.exports = (sequelize, DataTypes) => {
const { Sequelize } = sequelize;
const ClassCrisp = require('../Class/Crisp');
const Crisp = new ClassCrisp();
// This section contains the fields of your model, mapped to your table's columns.
// Learn more here: https://docs.forestadmin.com/documentation/v/v5/reference-guide/models/enrich-your-models#declaring-a-new-field-in-a-model
const Users = sequelize.define('users', {
userId: {
type: DataTypes.BIGINT,
primaryKey: true,
autoIncrement: true
},
compId: {
type: DataTypes.BIGINT,
},
email: {
type: DataTypes.STRING,
},
password: {
type: DataTypes.STRING,
},
indicMobile: {
type: DataTypes.STRING,
},
mobile: {
type: DataTypes.STRING,
},
stripeId: {
type: DataTypes.STRING,
},
crispId: {
type: DataTypes.STRING,
},
blocked: {
type: DataTypes.BOOLEAN,
defaultValue: Sequelize.literal('0'),
},
createdAt: {
type: DataTypes.DATE,
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP'),
},
updatedAt: {
type: DataTypes.DATE,
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP'),
},
}, {
tableName: 'users',
hooks: {
afterUpdate: async (user) => {
if (user.dataValues.compId != user._previousDataValues.compId) {
await sequelize.models.users.findOne({
where: { userId: user.dataValues.userId },
include: [{
model: sequelize.models.usersDatas
}]
}).then(async (user) => {
await sequelize.models.compagnies.findOne({
where: { compId: user.dataValues.compId }
}).then((company) => {
console.log(user.usersData);
user.usersData.update({
defaultLoc: 0
});
Crisp.updateUserCompany(user, company);
});
});
}
return user;
}
}
});
// This section contains the relationships for this model. See: https://docs.forestadmin.com/documentation/v/v5/reference-guide/relationships#adding-relationships.
Users.associate = (models) => {
Users.hasOne(models.usersDatas, {
foreignKey: 'userId'
});
Users.hasMany(models.orders, {
foreignKey: 'userId'
});
Users.belongsTo(models.compagnies, {
foreignKey: 'compId'
});
};
return Users;
};
users-datas.js
// This model was generated by Lumber. However, you remain in control of your models.
// Learn how here: https://docs.forestadmin.com/documentation/v/v5/reference-guide/models/enrich-your-models
module.exports = (sequelize, DataTypes) => {
const { Sequelize } = sequelize;
// This section contains the fields of your model, mapped to your table's columns.
// Learn more here: https://docs.forestadmin.com/documentation/v/v5/reference-guide/models/enrich-your-models#declaring-a-new-field-in-a-model
const UsersDatas = sequelize.define('usersDatas', {
userId: {
type: DataTypes.BIGINT,
primaryKey: true,
},
defaultLoc: {
type: DataTypes.BIGINT,
},
firstName: {
type: DataTypes.STRING,
},
lastName: {
type: DataTypes.STRING,
},
dateOfBirth: {
type: DataTypes.DATE,
},
gender: {
type: DataTypes.INTEGER,
},
adresse: {
type: DataTypes.STRING,
},
city: {
type: DataTypes.STRING,
},
zipCode: {
type: DataTypes.INTEGER,
},
country: {
type: DataTypes.STRING,
},
language: {
type: DataTypes.STRING,
defaultValue: Sequelize.literal('en_US'),
},
emailValidated: {
type: DataTypes.STRING,
defaultValue: Sequelize.literal('error'),
},
emailValidatedExp: {
type: DataTypes.DATE,
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP'),
},
resetPassword: {
type: DataTypes.STRING,
},
resetPasswordExp: {
type: DataTypes.DATE,
},
createdAt: {
type: DataTypes.DATE,
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP'),
},
updatedAt: {
type: DataTypes.DATE,
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP'),
},
}, {
tableName: 'usersDatas',
});
// This section contains the relationships for this model. See: https://docs.forestadmin.com/documentation/v/v5/reference-guide/relationships#adding-relationships.
UsersDatas.associate = (models) => {
UsersDatas.belongsTo(models.users, {
foreignKey: 'userId'
});
};
return UsersDatas;
};
Here is my route:
// Create a User
router.post('/users', permissionMiddlewareCreator.create(), (request, response, next) => {
const recordCreator = new RecordCreator(users);
recordCreator.deserialize(request.body)
.then(recordToCreate => recordCreator.create(recordToCreate))
.then(record => recordCreator.serialize(record))
.then(recordSerialized => response.send(recordSerialized))
.catch(next);
});