Fix where parsing needs to be spread #18

Closed
joeybaker wants to merge 1 commits from fix-list-where into master
joeybaker commented 2016-09-02 22:16:58 +00:00 (Migrated from github.com)

Otherwise we get a sequelize options object that looks like

{
  where: {
    where: {}
  }
}
Otherwise we get a sequelize options object that looks like ``` js { where: { where: {} } } ```
joeybaker commented 2016-09-02 22:17:22 +00:00 (Migrated from github.com)

@mdibaiee quick bug fix

@mdibaiee quick bug fix
mdibaiee commented 2016-09-03 06:39:00 +00:00 (Migrated from github.com)

Um, parseWhere returns a flat object containing key: values of the query, and we set that to where, what's wrong with that? I mean parseWhere doesn't return where: {}, does it?

Um, `parseWhere` returns a flat object containing `key: value`s of the query, and we set that to `where`, what's wrong with that? I mean `parseWhere` doesn't return `where: {}`, does it?
joeybaker commented 2016-09-03 15:07:49 +00:00 (Migrated from github.com)

It actually does return an object with a key of where :/

It actually does return an object with a key of `where` :/
mdibaiee commented 2016-09-03 15:50:12 +00:00 (Migrated from github.com)

It depends on the query parameters it gets, so if you pass it a where=someJSON, yes, it returns an object with a key where, but if you just pass plain query parameters, like name=joey, it will return { name: 'joey' }. Am I right?

In this case, this patch breaks the name=joey style (I actually used this style in my own code, that's why I was surprised 😁).

It depends on the query parameters it gets, so if you pass it a `where=someJSON`, yes, it returns an object with a key `where`, but if you just pass plain query parameters, like `name=joey`, it will return `{ name: 'joey' }`. Am I right? In this case, this patch breaks the `name=joey` style (I actually used this style in my own code, that's why I was surprised :grin:).
joeybaker commented 2016-09-03 18:53:38 +00:00 (Migrated from github.com)

Ah! Understood. I misunderstood how this was supposed to work.

I'll add docs instead :)

Ah! Understood. I misunderstood how this was supposed to work. I'll add docs instead :)

Pull request closed

Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: thereadme/hapi-sequelize-crud#18
No description provided.