Created
July 17, 2014 22:04
-
-
Save auggernaut/2ac0f77f66a21e8b0a22 to your computer and use it in GitHub Desktop.
update pref table in parse.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# UPDATE Pref table to include current user in peggedBy array | |
console.log "peggee: #{peggeeId} card: #{cardId} choice: #{choiceId} " | |
card = new Parse.Object 'Card' | |
card.set 'id', cardId | |
peggee = new Parse.Object 'User' | |
peggee.set 'id', peggeeId | |
prefQuery = new Parse.Query 'Pref' | |
prefQuery.equalTo 'card', card | |
prefQuery.equalTo 'user', peggee | |
prefQuery.first | |
success: (pref) => | |
pref.addUnique 'peggedBy', UserStore.getUser().id | |
#pref.set 'peggedBy', null | |
pref.save() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment