Actually delete

This commit is contained in:
Mentor Palokaj 2021-11-17 13:40:40 +01:00
parent 115a510999
commit 8574c53bf8

View File

@ -89,7 +89,7 @@ exports.setAvatar = async function( req, res ) {
exports.resetAvatar = async function( req, res ) {
const chain = process.env.NODE_ENV == 'development' ? '0x4' : '0x1'
// const chain = process.env.NODE_ENV == 'development' ? '0x4' : '0x1'
const network = 'mainnet'
// const chain = '0x1'
@ -117,6 +117,12 @@ exports.resetAvatar = async function( req, res ) {
}
const cachedJson = JSON.parse( jsonstring )
// Delete the address
if( jsonstring.images[ address ] ) {
delete jsonstring.images[ address ]
delete jsonstring.ids[ address ]
}
// Get items that have not been updated
const tenSecondsAgo = Date.now() - ( 10 * 1000 )
const shouldBeUpdated = await db.collection( `${ network }Validators` ).where( 'updated', '>', cachedJson.updated || tenSecondsAgo ).get().then( dataFromSnap )