You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
function populateUser(options = {}) { // eslint-disable-line no-unused-vars
return async context => {
const { app, method, result, params } = context;
// Function that adds the user to a single message object
const addUser = async message => {
// Get the user based on their id, pass the `params` along so
// that we get a safe version of the user data
const user = await app.service('users').get(message.userId, params);
the user variable there has the strings and not date objects, so it feels like it could be a bug on this module.
CREATE TABLE `users` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `name` VARCHAR(255) NOT NULL, `email` VARCHAR(255) NOT NULL UNIQUE, `password` VARCHAR(255) NOT NULL, `avatar` VARCHAR(255) NOT NULL, `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL);
I also tried to go a bit further now and hack into this repo:
_get (id, params = {}) {
const { query: where } = this.filterQuery(params);
// Attach 'where' constraints, if any were used.
const q = Object.assign({
raw: this.raw,
where: Object.assign({
[this.Op.and]: { [this.id]: id }
}, where)
}, params.sequelize);
const Model = this.applyScope(params);
// findById calls findAll under the hood. We use findAll so that
// eager loading can be used without a separate code path.
return Model.findAll(q).then(result => {
+ console.error(q);
+ console.error(Model);
+ console.error(result);
and sequelize itself does appear to be returning strings...:
Steps to reproduce
I'm not 100% sure if this is a bug or if I'm misusing something, but here goes.
This is a port of the chat app to sequelize:
Now, uncomment the following test that is unexpectedly failing:
and run:
or for greater isolation:
The test fails because
service.create
andservice.get
are returning different things, one is a string and the other is a Date object:If I put a print on:
the
user
variable there has the strings and not date objects, so it feels like it could be a bug on this module.Sequelize itself does seem to do the conversion correctly on a minimal example: https://github.com/cirosantilli/linux-kernel-module-cheat/blob/461aa04b8b79336c5f9a0b69ee5cf0004a5b5f19/rootfs_overlay/lkmc/nodejs/sequelize.js#L116 so it feels like something inside feathers is converting it to string at some point.
The sqlite schema does have
DATETIME
:gives:
I also tried to go a bit further now and hack into this repo:
and sequelize itself does appear to be returning strings...:
so not sure how that is possible.
System configuration
Tell us about the applicable parts of your setup.
Module versions (especially the part that's not working):
sqlite 3.33
NodeJS version: 14.16.0
Operating System: Ubuntu 20.10
Browser Version:
React Native Version:
Module Loader:
The text was updated successfully, but these errors were encountered: