Skip to content

Instantly share code, notes, and snippets.

@yvesbou
Created February 18, 2022 09:46
Show Gist options
  • Save yvesbou/d821230886a48015889b57c2c77e23d0 to your computer and use it in GitHub Desktop.
Save yvesbou/d821230886a48015889b57c2c77e23d0 to your computer and use it in GitHub Desktop.
const { models } = require("mongoose")
module.exports = async (_, {id, input}, {models}) => {
const ERC20CoinToUpdate = await models.ERC20Coin.findOne({_id: id});
Object.keys(input).forEach(value => {
ERC20CoinToUpdate[value] = input[value];
});
const updatedERC20Coin = await ERC20CoinToUpdate.save();
return updatedERC20Coin;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment