Пример #1
0
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)
Пример #2
0
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)
Пример #3
0
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)
Пример #4
0
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)
Пример #5
0
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
Пример #6
0
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)
Пример #7
0
def add_user(uid, name):
    user_repo = app.get_user_repo()
    u = user.User(uid, name)
    user_repo.save(u)
Пример #8
0
def get_user(uid):
    user_repo = app.get_user_repo()
    u = user_repo.find(uid)
    return u
Пример #9
0
def list_users():
    user_repo = app.get_user_repo()
    return user_repo.find_all()