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)
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)
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)
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})
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)
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)
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)
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)
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)
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)
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)
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})