From 7bef368a1ae67c6f3ca087f91d830b622ba0577b Mon Sep 17 00:00:00 2001 From: Peng_Lx Date: Thu, 6 Apr 2023 21:43:16 +0800 Subject: [PATCH] Update abstract class about database --- src/educoder/core/__init__.py | 0 src/educoder/core/permission/__init__.py | 0 src/educoder/core/permission/permission.py | 8 +++++ src/educoder/database/database.py | 38 +++++++++++++++++++++- 4 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 src/educoder/core/__init__.py create mode 100644 src/educoder/core/permission/__init__.py create mode 100644 src/educoder/core/permission/permission.py diff --git a/src/educoder/core/__init__.py b/src/educoder/core/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/educoder/core/permission/__init__.py b/src/educoder/core/permission/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/educoder/core/permission/permission.py b/src/educoder/core/permission/permission.py new file mode 100644 index 0000000..3cc0510 --- /dev/null +++ b/src/educoder/core/permission/permission.py @@ -0,0 +1,8 @@ +from enum import Enum, unique + + +@unique +class Permission(Enum): + NONE = 0 + USER = 1 + ADMIN = 2 diff --git a/src/educoder/database/database.py b/src/educoder/database/database.py index 3318868..ee1aff6 100644 --- a/src/educoder/database/database.py +++ b/src/educoder/database/database.py @@ -1,3 +1,39 @@ +from src.educoder.core.permission.permission import Permission + + class Database(object): - def connection(self): + def addBook(self, unique_id, isbn, state): pass + + def removeBook(self, unique_id): + pass + + def addUser(self, user_id, userpass_word, permission: Permission, nick_name): + pass + + def modifyUserPermission(self, user_id, permission: Permission): + pass + + def removeUser(self, unique_id): + pass + + def addBookInformation(self, isbn, author, description, price, made_time, image, category): + pass + + def removeBookInformation(self, isbn): + pass + + def brownBook(self, unique_id, brownuser): + pass + + def stillBook(self, unique_id): + pass + + def addCategory(self, category): + pass + + def removeCategory(self, category): + pass + + def login(self, user_id, password): + return True