From 467f801b93ba5de9af7c61c09667cc00ec64d406 Mon Sep 17 00:00:00 2001 From: piyush-jaiswal Date: Fri, 7 Nov 2025 16:04:17 +0530 Subject: [PATCH 1/2] remove unneeded to_json --- app/models.py | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/app/models.py b/app/models.py index 459f0e8..61c7510 100644 --- a/app/models.py +++ b/app/models.py @@ -82,13 +82,6 @@ class Category(db.Model): ConstraintFactory.non_empty_string('name'), ) - def to_json(self): - return { - 'id': self.id, - 'name': self.name, - 'created_at': self.created_at, - } - class Subcategory(db.Model): __tablename__ = 'subcategory' @@ -102,13 +95,6 @@ class Subcategory(db.Model): ConstraintFactory.non_empty_string('name'), ) - def to_json(self): - return { - 'id': self.id, - 'name': self.name, - 'created_at': self.created_at, - } - class Product(db.Model): __tablename__ = 'product' @@ -121,11 +107,3 @@ class Product(db.Model): __table_args__ = ( ConstraintFactory.non_empty_string('name'), ) - - def to_json(self): - return { - 'id': self.id, - 'name': self.name, - 'description': self.description, - 'created_at': self.created_at, - } From 704bcf7e8fdfc4c2d6d66e110c2e478ef6282bd4 Mon Sep 17 00:00:00 2001 From: piyush-jaiswal Date: Fri, 7 Nov 2025 16:05:11 +0530 Subject: [PATCH 2/2] use / in collections --- app/routes/category.py | 2 +- app/routes/product.py | 2 +- app/routes/subcategory.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/routes/category.py b/app/routes/category.py index 6622b39..2bd29ad 100644 --- a/app/routes/category.py +++ b/app/routes/category.py @@ -25,7 +25,7 @@ bp = Blueprint("Category", __name__) -@bp.route("") +@bp.route("/") class CategoryCollection(MethodView): init_every_request = False diff --git a/app/routes/product.py b/app/routes/product.py index e923dd2..1f77dc7 100644 --- a/app/routes/product.py +++ b/app/routes/product.py @@ -24,7 +24,7 @@ bp = Blueprint("Product", __name__) -@bp.route("") +@bp.route("/") class ProductCollection(MethodView): init_every_request = False _PER_PAGE = 10 diff --git a/app/routes/subcategory.py b/app/routes/subcategory.py index ba684fa..04e481b 100644 --- a/app/routes/subcategory.py +++ b/app/routes/subcategory.py @@ -26,7 +26,7 @@ bp = Blueprint("Subcategory", __name__) -@bp.route("") +@bp.route("/") class SubcategoryCollection(MethodView): init_every_request = False