Applied auto pep 8 changes
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from .database import DatabaseController
|
||||
from models.category import Category
|
||||
|
||||
|
||||
class CategoryController(DatabaseController):
|
||||
FIELDS = ['id', 'name']
|
||||
|
||||
@@ -18,7 +19,6 @@ class CategoryController(DatabaseController):
|
||||
)
|
||||
self._conn.commit()
|
||||
|
||||
|
||||
def read(self, id: int = 0) -> Category | None:
|
||||
params = [
|
||||
id
|
||||
@@ -32,12 +32,11 @@ class CategoryController(DatabaseController):
|
||||
|
||||
if row == None:
|
||||
return None
|
||||
|
||||
|
||||
params = dict(zip(self.FIELDS, row))
|
||||
obj = self.new_instance(Category, params)
|
||||
|
||||
return obj
|
||||
|
||||
return obj
|
||||
|
||||
def read_all(self) -> list[Category] | None:
|
||||
cursor = self._conn.execute(
|
||||
@@ -47,18 +46,18 @@ class CategoryController(DatabaseController):
|
||||
|
||||
if rows == None:
|
||||
return None
|
||||
|
||||
|
||||
categories = list()
|
||||
|
||||
for category in rows:
|
||||
params = dict(zip(self.FIELDS, category))
|
||||
obj = self.new_instance(Category, params)
|
||||
categories.append(obj)
|
||||
|
||||
|
||||
return categories
|
||||
|
||||
def update(self):
|
||||
print("Doing work")
|
||||
|
||||
|
||||
def delete(self):
|
||||
print("Doing work")
|
||||
print("Doing work")
|
||||
|
||||
Reference in New Issue
Block a user