improve responses

This commit is contained in:
2025-04-15 14:44:37 +01:00
parent 9b36592fce
commit b21a4c0029
4 changed files with 17 additions and 2 deletions
+2
View File
@@ -0,0 +1,2 @@
from .handlers import (method_not_allowed, unsupported_media_type,
not_found, bad_request, success, created, updated)
+30
View File
@@ -0,0 +1,30 @@
from flask import jsonify
from app.helpers.response_helper import ResponseHelper
def method_not_allowed(error):
return ResponseHelper.method_not_allowed(message="Method Not Allowed")
def not_found(error):
return ResponseHelper.not_found(message="URL Not Found")
def bad_request(error):
return ResponseHelper.bad_request(message="Bad Request")
def unsupported_media_type(error):
return ResponseHelper.error(message="Unsupported Media Type", status_code=415)
def success(data):
return ResponseHelper.success(data=data)
def created(data):
return ResponseHelper.created(data=data)
def updated(data):
return ResponseHelper.updated(data=data)