def getAllProjects(self): session = create_session() projectList = session.query(Project).order_by(Project.id).all() session.close() return projectList
def getProjectById(self, id): session = create_session() project = session.query(Project).filter(Project.id == id).one() session.close() return project
def addProject(self, project): session = create_session() session.add(project) session.commit() session.close()
def addUser(self, user): session = create_session() session.add(user) session.commit() session.close()
def getAllUsers(self): session = create_session() userList = session.query(User).order_by(Task.username).all() session.close() return userList
def getUserById(self, id): session = create_session() user = session.query(User).filter(User.id == id).one() session.close() return user
def getAllTasks(self): session = create_session() taskList = session.query(Task).order_by(Task.id).all() session.close() return taskList
def addTask(self, task): session = create_session() session.add(task) session.commit() session.close()
def getTaskById(self, id): session = create_session() task = session.query(Task).filter(Task.id == id).one() session.close() return task
def getTasksByProjectId(self, projectId): session = create_session() taskList = session.query(Task).filter( Task.project_id == projectId).all() session.close() return taskList