def list_user_assinged_works(user_id): task_repo = app.get_task_repo() user_repo = app.get_user_repo() work_repo = app.get_work_repo() user = user_repo.find(user_id) return work_repo.find_by_user(user, task_repo)
def add_user_to_group(uid, gid): group_repo = app.get_group_repo() user_repo = app.get_user_repo() u = user_repo.find(uid) g = group_repo.find(gid) group_repo.add_user(g, u.id)
def assign_task_to_user(task_id, user_id): task_repo = app.get_task_repo() user_repo = app.get_user_repo() work_repo = app.get_work_repo() task = task_repo.find(task_id) user = user_repo.find(user_id) w = work.Work(uuid.uuid1().hex, task, user, work.Work.WorkStatus.PROGRESS) work_repo.save(w)
def complete_task(user_id, task_id): task_repo = app.get_task_repo() user_repo = app.get_user_repo() work_repo = app.get_work_repo() task = task_repo.find(task_id) user = user_repo.find(user_id) w = work_repo.find_by_user_and_task(task, user) w.mark_as_done() work_repo.save(w)
def list_group_users(gid): group_repo = app.get_group_repo() user_repo = app.get_user_repo() g = group_repo.find(gid) uids = group_repo.user_ids(g) users = [] for uid in uids: u = user_repo.find(uid) users.append(u) return users
def assign_task_to_group(task_id, group_id): group_repo = app.get_group_repo() task_repo = app.get_task_repo() user_repo = app.get_user_repo() work_repo = app.get_work_repo() task = task_repo.find(task_id) g = group_repo.find(group_id) user_ids = group_repo.user_ids(g) for user_id in user_ids: user = user_repo.find(user_id) w = work.Work(uuid.uuid1().hex, task, user, work.Work.WorkStatus.PROGRESS) work_repo.save(w)
def add_user(uid, name): user_repo = app.get_user_repo() u = user.User(uid, name) user_repo.save(u)
def get_user(uid): user_repo = app.get_user_repo() u = user_repo.find(uid) return u
def list_users(): user_repo = app.get_user_repo() return user_repo.find_all()