From 926aaddb2817a2e50a2a77357d6ffe42a0039b67 Mon Sep 17 00:00:00 2001 From: Lim Jet <57783762+daoauth@users.noreply.github.com> Date: Tue, 16 Jul 2024 18:00:30 +0900 Subject: [PATCH] Update index.ts --- functions/src/index.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/functions/src/index.ts b/functions/src/index.ts index cc8c6ee..e2a47cb 100644 --- a/functions/src/index.ts +++ b/functions/src/index.ts @@ -25,12 +25,12 @@ export const create = onRequest(async (req, res) => { return; } - const { network, project, provenance } = req.body as DocData; + const { name, network, project, provenance } = req.body as DocData; if (!network || !project || !provenance) { res .status(400) - .send('Invalid input, missing "network", "project" or "provenance"'); + .send('Invalid input, missing "name", "network", "project" or "provenance"'); return; } @@ -39,6 +39,7 @@ export const create = onRequest(async (req, res) => { const firestore = admin.firestore(); const docRef = firestore.collection('unsigned').doc(uid); await docRef.set({ + name, network, project, provenance, @@ -109,13 +110,13 @@ const _load = async ( return; } - const { network, project, provenance, serializedSignedTx } = + const { name, network, project, provenance, serializedSignedTx } = doc.data() as DocData; if (collection === 'signed') { await docRef.delete(); - res.status(200).json({ network, serializedSignedTx }); + res.status(200).json({ name, network, serializedSignedTx }); } else { - res.status(200).json({ network, project, provenance }); + res.status(200).json({ name, network, project, provenance }); } } catch (error) { console.error(`Error reading and deleting data from ${collection}:`, error);