def update_project(request, project_id, **kwargs): """updating a project""" user = request.user log.info(user) body = json.loads(request.body) log.info(body) body = ProjectService._parse_keywords(**body) project = ProjectService.update_project(project_id, **body) return project.to_dict()
def create_project(request, *args, **kwargs): """creating a new project""" user = request.user log.info(user) body = json.loads(request.body) project = ProjectService.create_project(user, **body) return project.to_dict()
def get_project(request, *args, **kwargs): """getting projects by user""" user = request.user query = request.GET or dict() log.info(query) log.info(user) projects = ProjectService.filter_project_by_user(user, **query) return dict(projects=projects)
def delete_project(request, project_id, **kwargs): """deleting a project""" user = request.user log.info(user) project = ProjectService.delete_project(project_id) return project.to_dict()