please help I try to update the table but I don’t succeed, what am I wrong?
Moralis.Cloud.afterSave("Trasactions", async (request) => {
const obj = JSON.stringify(request.object)
const myObj = JSON.parse(obj);
const query = new Moralis.Query("ItemsMinted");
query.equalTo( "tokenId", myObj.tokenId );
const object = await query.first({ useMasterKey: true });
logger.info("object", JSON.stringify( object ) );
logger.info("myObj", JSON.stringify( myObj ) );
logger.info("token_id", myObj.tokenId );
const tokenIdItemsMinted = object.get('ownerAddress')
if ( myObj.from != myObj.to && tokenIdItemsMinted != myObj.to && myObj.from != '0x0000000000000000000000000000000000000000' ){
logger.info("entro en compra");
logger.info("object", JSON.stringify(object));
const query2 = new Moralis.Query("ItemsMinted");
query2.equalTo( "tokenId", myObj.tokenId );
const object2 = await query.first({ useMasterKey: true });
object2.set('forSale', false);
object2.set('ownerAddress', myObj.to );
await object2.save({ useMasterKey: true });
}
logger.info("finish process");
});