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.177]) by gnuweeb.org (Postfix) with ESMTPSA id 3931D804FD; Sat, 1 Oct 2022 13:04:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1664629472; bh=o+vTUbJFkUsXDsC5o2Btuj+WxMBpkrsG3pY64TW1SC4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RRv844IUVf+k43o64vfPZyc7fpgh9A4ykbJ/pTNtIUFzZXAyCbKnrG3+7A2j0XSpz 7YBRThq9BzsFyFb/MOCL+bKFOxPPe1wWdv7G4iWnkqyxmLXx/F6TTXbyPZLeFdYmI3 adzQ3Retcs1ermDES1b+q1+ADusgkNUvLBFhk04BNJJauNT8g7OHdOiHVJuFGIxdUL 07d1PORAnKgRGEPJmUFrbYZG4X5yqKSkHQpbfkPC2VkvSobjp1Ek3EMC/V7212J2aG xoahd26cPRP4y0XFScOUw8FdQFf5yjBbvqQAgWoURt85U51YHgCfj0PSb31B95ze8y qLV0NsLoiBh3w== From: Muhammad Rizki To: Ammar Faizi Cc: Muhammad Rizki , Alviro Iskandar Setiawan , GNU/Weeb Mailing List Subject: [PATCH v1 07/26] discord: Add delete_atom() in deletion directory Date: Sat, 1 Oct 2022 20:03:35 +0700 Message-Id: <20221001130355.784-8-kiizuha@gnuweeb.org> X-Mailer: git-send-email 2.34.1.windows.1 In-Reply-To: <20221001130355.784-1-kiizuha@gnuweeb.org> References: <20221001130355.784-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