コード例 #1
0
ファイル: app.py プロジェクト: jackyhocs/htn-api
    def delete(self, _id):
        '''
        Takes in an int as an id and deletes the user with the id
        :param _id:
        :return:

        :param _id:
        :return:
        Failure - Error codes: 500, 404
        Success - No Content: 204
        '''
        user_model = UserModel()
        try:
            user_model.delete_user(_id)
        except DataError:
            return {
                "message": "User with ID {} does not exist".format(_id)
            }, 404
        except (DatabaseError, IntegrityError):
            return {"message": "Internal Server Error"}, 500
        except Exception as e:
            return {"message": "Exception : {}".format(str(e))}, 500

        return {}, 204