From 39920c975f1ba861ee88641dbd72b0df33a9c8fb Mon Sep 17 00:00:00 2001 From: artur Date: Thu, 15 Feb 2024 15:56:34 +0300 Subject: [PATCH] Fix processing of CLI params --- src/index.js | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/index.js b/src/index.js index 9630d19..ce0327b 100644 --- a/src/index.js +++ b/src/index.js @@ -804,7 +804,7 @@ app.post(NAME_PATH, async (req, res) => { const names = await prisma.names.findMany({ where: { npub, - name + name, }, }); const alreadyAssigned = names.find((n) => n.name === name); @@ -1073,6 +1073,7 @@ if (process.argv.length >= 3) { prisma.names.findMany().then((names) => { for (const n of names) console.log(n.id, n.name, n.npub, n.timestamp); }); + return; } else if (process.argv[2] === "delete_name") { if (process.argv.length < 4) { console.log("enter name"); @@ -1082,15 +1083,16 @@ if (process.argv.length >= 3) { prisma.names.delete({ where: { name } }).then((r) => { console.log("deleted", name, r); }); + return; } -} else { - // start bunker - ndk.connect().then(startBunker); - - // start server - loadFromDb().then(() => { - app.listen(port, () => { - console.log(`Listening on port ${port}!`); - }); - }); } + +// start bunker +ndk.connect().then(startBunker); + +// start server +loadFromDb().then(() => { + app.listen(port, () => { + console.log(`Listening on port ${port}!`); + }); +});