Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

actionUtil.parseValues returns 'id' field even if Model.primaryKey is not 'id' #3625

Closed
swarthy opened this issue Mar 1, 2016 · 1 comment
Labels

Comments

@swarthy
Copy link

swarthy commented Mar 1, 2016

Model Goal.js:

module.exports = {
  attributes: {
    hash: {
      type: 'string',
      unique: true,
      primaryKey: true
    },
    id: 'integer', // from 1 to 20 (not unique)
    active: 'boolean',
    ...
  }
}

Response from Google Analytics API is stored here (I want to save same field names).
'id' is returned from Google and it is not unique (may be only 20 goals for GA counter), so I use my 'hash' field as PK
The problem is that on update actionUtil.parseValues returns object like that:

{
  hash: '<myhash>',
  id: '<myhash>',
  name: 'newName'
}

and it brakes my data
when I send
PUT /goal/<myhash> {active: false}
blueprint set

{
  id: '<myhash>',
  active: false
}

I figured it out by overriding GoalController.update, but is there any way possible to fix this issue?
Hope, you understood what I wanted to say 😄

@swarthy swarthy changed the title actionUtil.parseValues return 'id' field even when Model.primaryKey is not 'id' actionUtil.parseValues returns 'id' field even if Model.primaryKey is not 'id' Mar 1, 2016
@sgress454 sgress454 added the bug label Mar 1, 2016
@sgress454
Copy link
Member

Thanks for the report @swarthy, we'll look into it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants