def get_user(self, id_user): try: # get user by id res = get_user_by_id_or_email(id_user, "id", "first_name", "last_name", "email") if res['error']: return response(1003, res['message']) else: return response(200, res['data']) except Exception as error: return response(1008, str(error))
def health_check(self): return response(200, "Success")
def bad_request(error): return response( 400, "The browser (or proxy) sent a request that this server could not understand." ), 400
def internal_server_error(error): return response(500, "Terjadi masalah pada server."), 500
def unauthorized_eror(error): return response(410, "Anda tidak memiliki akses."), 410
def forbidden_error(error): return response(403, "Anda tidak memiliki akses."), 403
def page_not_found(error): return response(404, "Halaman yang Anda minta tidak tersedia."), 400
def method_not_allowed(error): return response(405, "The method is not allowed for the requested URL."), 405