Skip to content

Commit

Permalink
chore(hapi): revert splitting of producer insertion mutation
Browse files Browse the repository at this point in the history
  • Loading branch information
Torresmorah committed Nov 1, 2022
1 parent b62b80a commit a4e3a1f
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions hapi/src/services/producer.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,9 @@ const eosioService = require('./eosio.service')
const nodeService = require('./node.service')

const updateProducers = async (producers = []) => {
const upsertMutationBPJSONs = `
mutation ($producers: [producer_insert_input!]!) {
insert_producer(objects: $producers, on_conflict: {constraint: producer_owner_key, update_columns: [ bp_json ], where: { bp_json: {_eq: {} }}}) {
affected_rows,
returning {
id,
bp_json
}
}
}
`
const upsertMutation = `
mutation ($producers: [producer_insert_input!]!) {
insert_producer(objects: $producers, on_conflict: {constraint: producer_owner_key, update_columns: [ producer_key, unpaid_blocks,last_claim_time, url, location, producer_authority, is_active, total_votes, total_votes_percent, total_votes_eos, vote_rewards,block_rewards, total_rewards, health_status, endpoints, rank]}) {
insert_producer(objects: $producers, on_conflict: {constraint: producer_owner_key, update_columns: [ producer_key, unpaid_blocks,last_claim_time, url, location, producer_authority,bp_json, is_active, total_votes, total_votes_percent, total_votes_eos, vote_rewards,block_rewards, total_rewards, health_status, endpoints, rank]}) {
affected_rows,
returning {
id,
Expand All @@ -35,7 +24,6 @@ const updateProducers = async (producers = []) => {
}
}
`
await hasuraUtil.request(upsertMutationBPJSONs, { producers })

const insertedRows = await hasuraUtil.request(upsertMutation, { producers })

Expand Down

0 comments on commit a4e3a1f

Please sign in to comment.