예제 #1
0
    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))
예제 #2
0
    def health_check(self):

        return response(200, "Success")
예제 #3
0
def bad_request(error):
    return response(
        400,
        "The browser (or proxy) sent a request that this server could not understand."
    ), 400
예제 #4
0
def internal_server_error(error):
    return response(500, "Terjadi masalah pada server."), 500
예제 #5
0
def unauthorized_eror(error):
    return response(410, "Anda tidak memiliki akses."), 410
예제 #6
0
def forbidden_error(error):
    return response(403, "Anda tidak memiliki akses."), 403
예제 #7
0
def page_not_found(error):
    return response(404, "Halaman yang Anda minta tidak tersedia."), 400
예제 #8
0
def method_not_allowed(error):
    return response(405,
                    "The method is not allowed for the requested URL."), 405