Esempio n. 1
0
    def get(self):
        identity = get_jwt_identity()
        if not is_admin(identity):
            return make_response({'success': False}, 401)

        clients = fetch_clients()
        return make_response({'success': True, 'clients': clients}, 200)
Esempio n. 2
0
    def put(self, id):
        identity = get_jwt_identity()
        if not is_admin(identity):
            return make_response({
                'success': False,
                'message': 'unauthorized'
            }, 401)

        blog = get_blog(id)

        if not blog:
            return make_response(
                {
                    'success': False,
                    'message': 'blog not found'
                }, 404)

        args = self.reqparse.parse_args()
        updated_blog = update_blog(id, args)

        if not update_blog:
            return make_response(
                {
                    'success': False,
                    'message': 'couldn`t update blog'
                }, 500)

        return make_response({'success': True, 'blog': updated_blog}, 200)
Esempio n. 3
0
    def delete(self, id):
        identity = get_jwt_identity()
        if not is_admin(identity):
            return make_response({
                'success': False,
                'message': 'unauthorized'
            }, 401)

        blog = get_blog(id)

        if not blog:
            return make_response(
                {
                    'success': False,
                    'message': 'blog not found'
                }, 404)

        if not delete_blog(id):
            return make_response(
                {
                    'success': False,
                    'message': 'couldn`t delete blog'
                }, 500)

        return make_response({'success': True}, 200)
Esempio n. 4
0
    def put(self, id):
        identity = get_jwt_identity()
        if not is_admin(identity):
            return make_response({
                'success': False,
                'message': 'unauthorized'
            }, 401)

        project = get_project(id)
        if not project:
            return make_response(
                {
                    'success': False,
                    'message': 'project not found'
                }, 404)

        args = self.reqparse.parse_args()
        if not update_project(id, args):
            return make_response(
                {
                    'success': False,
                    'message': 'couldn`t update resource'
                }, 500)

        updated = get_project(id)
        return make_response({'success': True, 'project': project})
Esempio n. 5
0
    def delete(self):
        identity = get_jwt_identity()
        if not is_admin(identity):
            return make_response({
                'success': False,
                'message': 'unauthorized'
            }, 401)

        total = delete_projects()
        return make_response({'success': True, 'total_deleted': total}, 200)
Esempio n. 6
0
    def delete(self, id):
        identity = get_jwt_identity()
        if not is_admin(identity):
            return make_response({
                'success': False,
                'message': 'unauthorized'
            }, 401)

        if not delete_skill_set(id):
            return make_response({
                'success': False,
                'message': 'not found'
            }, 404)

        return make_response({'success': True}, 200)
Esempio n. 7
0
    def post(self):
        identity = get_jwt_identity()
        if not is_admin(identity):
            return make_response({
                'success': False,
                'message': 'unauthorized'
            }, 401)

        project_data = self.reqparse.parse_args()
        new_project = add_project(project_data)

        if not new_project:
            return make_response({'success': False}, 400)

        return make_response({'success': True, 'project': new_project}, 200)
Esempio n. 8
0
    def delete(self):
        identity = get_jwt_identity()
        if not is_admin(identity):
            return make_response({
                'success': False,
                'message': 'unauthorized'
            }, 401)

        if not delete_blogs():
            return make_response(
                {
                    'success': False,
                    'message': 'Couldn`t delete blog'
                }, 500)

        return make_response({'success': True}, 200)
Esempio n. 9
0
    def post(self):
        identity = get_jwt_identity()
        if not is_admin(identity):
            return make_response({
                'success': False,
                'message': 'unauthorized'
            }, 401)

        args = self.reqparse.parse_args()
        title = args.get('title')
        stack = args.get('stack')

        skill = add_skill(title, stack)
        if not skill:
            return make_response({'success': False}, 400)

        return make_response({'success': True, 'skill': skill}, 200)
Esempio n. 10
0
    def post(self):
        identity = get_jwt_identity()
        if not is_admin(identity):
            return make_response({
                'success': False,
                'message': 'unauthorized'
            }, 401)

        args = self.reqparse.parse_args()
        new_blog = add_blog(args)

        if not new_blog:
            return make_response(
                {
                    'success': False,
                    'message': 'Couldn`t add blog'
                }, 500)

        return make_response({'success': True, 'blog': new_blog}, 200)
Esempio n. 11
0
    def put(self, id):
        identity = get_jwt_identity()
        if not is_admin(identity):
            return make_response({
                'success': False,
                'message': 'unauthorized'
            }, 401)

        args = self.reqparse.parse_args()
        stack = args.get('stack')
        full = args.get('full')

        update = update_skill_set(id, stack, full)
        if not update:
            return make_response({
                'success': False,
                'message': 'not found'
            }, 404)

        return make_response({'success': True}, 200)
Esempio n. 12
0
    def delete(self, id):
        identity = get_jwt_identity()
        if not is_admin(identity):
            return make_response({
                'success': False,
                'message': 'unauthorized'
            }, 401)

        project = get_project(id)
        if not project:
            return make_response(
                {
                    'success': False,
                    'message': 'project not found'
                }, 404)

        if not delete_project(id):
            return make_response(
                {
                    'success': False,
                    'message': 'couldn`t delete project'
                }, 500)

        return make_response({'success': True})