From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NO_DNS_FOR_FROM,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Received: from localhost.localdomain (unknown [101.128.125.217]) by gnuweeb.org (Postfix) with ESMTPSA id 7FBEE7E257; Mon, 3 Oct 2022 23:53:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1664841191; bh=o+vTUbJFkUsXDsC5o2Btuj+WxMBpkrsG3pY64TW1SC4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bYTX8bcAj9jrbmAP/xwt/7yeEc8FyczKow+ENDhUqYlnIURp4kxlLSX9q5A4lCz1O 5WQZTFGIuei5GT2+kyJN5hsoQSNYM64R1fBOxbKWcRr2/VInMde4QLVXE7as4ydHS8 eMWfSTKVPCb7yiZWln6x+qEO9bNK4jJ1sLIGDILWGOwHie+OlTstGVSX0XcpHd7yJs w1aEMDTOGYnBSxi8fT34W7a6ben8ytwXAo+CuNpiRfTcKoQLOR2GB6hAiKenRx4eoo gFeuN9XwdBbQAIw+ZWbn9BRz8HyOBR+ttwSEZr2pCmjHzOMXLSuVYaGIw99mACbW/4 jJc7fn8pzzJ0g== From: Muhammad Rizki To: Ammar Faizi Cc: Muhammad Rizki , Alviro Iskandar Setiawan , GNU/Weeb Mailing List Subject: [PATCH v2 09/28] discord: Add delete_atom() in deletion directory Date: Tue, 4 Oct 2022 06:52:10 +0700 Message-Id: <20221003235230.1824-10-kiizuha@gnuweeb.org> X-Mailer: git-send-email 2.34.1.windows.1 In-Reply-To: <20221003235230.1824-1-kiizuha@gnuweeb.org> References: <20221003235230.1824-1-kiizuha@gnuweeb.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Add delete_atom() for delete the specific atom URL. Signed-off-by: Muhammad Rizki --- .../dscord/database/methods/deletion/__init__.py | 12 ++++++++++++ .../database/methods/deletion/delete_atom.py | 15 +++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 daemon/dscord/database/methods/deletion/__init__.py create mode 100644 daemon/dscord/database/methods/deletion/delete_atom.py diff --git a/daemon/dscord/database/methods/deletion/__init__.py b/daemon/dscord/database/methods/deletion/__init__.py new file mode 100644 index 0000000..988bbee --- /dev/null +++ b/daemon/dscord/database/methods/deletion/__init__.py @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Copyright (C) 2022 Muhammad Rizki +# + + +from .delete_atom import DeleteAtom + + +class Deletion( + DeleteAtom, +): pass diff --git a/daemon/dscord/database/methods/deletion/delete_atom.py b/daemon/dscord/database/methods/deletion/delete_atom.py new file mode 100644 index 0000000..f2cbc2e --- /dev/null +++ b/daemon/dscord/database/methods/deletion/delete_atom.py @@ -0,0 +1,15 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Copyright (C) 2022 Muhammad Rizki +# + + +class DeleteAtom: + + def delete_atom(self, atom: str): + q = """ + DELETE FROM dc_atoms + WHERE url = %(atom)s + """ + self.cur.execute(q, {"atom": atom}) + return self.cur.rowcount > 0 -- Muhammad Rizki