def insert_projects(project):
    project_db = DBConnection('projects')

    project_db.update(project, 'projectId')

    return {
        'projects':
        project_db.find({'projectId': project.get('projectId', None)})
    }
예제 #2
0
def update_task(task):
    db = DBConnection('tasks')

    WORK_PROGRESS_WORKFLOW = [
        WORK_TYPES.get('TODO'),
        WORK_TYPES.get('IN_PROGRESS'),
        WORK_TYPES.get('DONE'),
    ]

    workflow_index = WORK_PROGRESS_WORKFLOW.index(task.get('type'))
    workflow_direction = task.get('workflowDirection')

    try:
        task.pop('workflowDirection')
        task.pop('_id')
    except:
        pass
    finally:
        if workflow_direction == 'NEXT' and workflow_index != len(
                WORK_PROGRESS_WORKFLOW):
            task['type'] = WORK_PROGRESS_WORKFLOW[workflow_index + 1]

        if workflow_direction == 'PREV' and workflow_index != 0:
            task['type'] = WORK_PROGRESS_WORKFLOW[workflow_index - 1]

    return {'tasks': [db.update(task, 'title')]}
def set_app_configs(app_config):
    application = DBConnection('application')
    try:
        for key in app_config.keys():
            config = dict({
                'configName': key,
                'value': app_config.get(key)
            })
            application.update(config, 'configName')
    except:
        return {
            'appConfig': False
        }

    return {
        'appConfig': True
    }
예제 #4
0
def insert_companies(companies):
    techDb = DBConnection('companies')

    new_list = [Company.load_from_json(company) for company in companies]

    for company in new_list:
        company.is_valid() and techDb.update(company.to_json(), 'companyId')

    return {'companies': techDb.find()}
예제 #5
0
def save_user(user):
    db = DBConnection('users')
    User.load_from_json(db.update(user.to_json(), user.get_key()))
예제 #6
0
def insert_technology(skill):
    techDb = DBConnection('technologies')

    techDb.update(skill, 'techId')

    return {'technologies': techDb.find({'techId': skill.get('techId', None)})}