Created
October 24, 2017 02:58
-
-
Save chasestarr/8cf133772846bb8cc9f44d26d9ba460e to your computer and use it in GitHub Desktop.
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
// model file | |
// is this a bad idea? | |
class Gig extends MongoModel { | |
/** | |
* extends the functionality of model update method | |
* | |
* @param {string} query - object to query db on | |
* @param {any[]} args - arguments to forward to parent class update | |
*/ | |
update(query: Object, ...args: any[]) { | |
console.log('id', query._id); | |
return super.update(query, ...args); | |
} | |
/** | |
* extends the functionality of model findOneAndUpdate method | |
* | |
* @param {string} id - gig id to find | |
* @param {any[]} args - arguments to forward to parent class update | |
*/ | |
findOneAndUpdate(query: Object, ...args: any[]) { | |
console.log('id', query._id); | |
return super.findOneAndUpdate(Object, ...args); | |
} | |
/** | |
* extends the functionality of model findByIdAndUpdate method | |
* | |
* @param {string} id - gig id to find | |
* @param {any[]} args - arguments to forward to parent class update | |
*/ | |
findByIdAndUpdate(id: string, ...args: any[]) { | |
console.log('id', id); | |
return super.findByIdAndUpdate(id, ...args); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment