From d91e57cdced7529b4a842e17276db8d979d38ef2 Mon Sep 17 00:00:00 2001 From: Sophia Date: Thu, 31 Oct 2024 13:03:44 +0000 Subject: [PATCH] voting fixes (#108) --- server/helpers/adapters/postgres.ts | 1 + server/index.ts | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/server/helpers/adapters/postgres.ts b/server/helpers/adapters/postgres.ts index 576b1163..ae2ec083 100644 --- a/server/helpers/adapters/postgres.ts +++ b/server/helpers/adapters/postgres.ts @@ -55,6 +55,7 @@ const format = ( const insert = async (params: Array) => { if (params.length < 10) throw Error('Invalid parameters'); + console.log('insert params', params); const cmd = 'INSERT INTO messages (id, address, version, timestamp, space, token, type, payload, sig, metadata, "actionId", data) VALUES ' + '($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12) ON CONFLICT ON CONSTRAINT messages_pkey DO NOTHING'; diff --git a/server/index.ts b/server/index.ts index edbd7144..c0b8680c 100644 --- a/server/index.ts +++ b/server/index.ts @@ -304,7 +304,7 @@ router.post('/message', async (req, res) => { if (!body || !body.address || !body.msg || !body.sig || !body.erc712Data) return sendError(res, 'wrong message body'); - console.log(msg); + console.log('msg:', msg); if ( //[payload, timestamp, token, space, type, version] == 6 @@ -454,7 +454,10 @@ router.post('/message', async (req, res) => { const { payload: payloadToParse } = proposals[0]; const payload = jsonParse(payloadToParse, payloadToParse); - const proposalStatus = await getProposalStatus(payload.proposalId, space); + const proposalStatus = await getProposalStatus( + msg.payload.proposalId, + space + ); const proposalEnd = proposalStatus.length > 0 ? proposalStatus[0].proposalEnd : payload.end;