def get_preview_files_for_project(project_id, page=-1): """ Return all preview files for given project. """ query = (PreviewFile.query.join(Task).filter( Task.project_id == project_id).order_by(desc(PreviewFile.updated_at))) return query_utils.get_paginated_results(query, page)
def get_tasks_for_project(project_id, page=0): """ Return all tasks for given project. """ query = Task.query.filter(Task.project_id == project_id).order_by( Task.updated_at.desc()) return query_utils.get_paginated_results(query, page, relations=True)
def get_comments_for_project(project_id, page=0): """ Return all comments for given project. """ query = (Comment.query.join(Task, Task.id == Comment.object_id).filter( Task.project_id == project_id).order_by(Comment.updated_at.desc())) return query_utils.get_paginated_results(query, page, relations=True)
def get_notifications_for_project(project_id, page=0): """ Return all notifications for given project. """ query = (Notification.query.join(Task).filter( Task.project_id == project_id).order_by( Notification.updated_at.desc())) return query_utils.get_paginated_results(query, page)
def get_playlists_for_project(project_id, page=0): """ Return all time spents for given project. """ query = Playlist.query.filter(Playlist.project_id == project_id) return query_utils.get_paginated_results(query, page, relations=True)
def get_time_spents_for_project(project_id, page=0): """ Return all time spents for given project. """ query = TimeSpent.query.join(Task).filter(Task.project_id == project_id) return query_utils.get_paginated_results(query, page)