Exemplo n.º 1
0
def edit(_id, message, image=None):
    item = get(_id)
    item['message'] = message
    item['image'] = image
    DB_answer.edit(item)
    item['message'] = message
    DB_answer.edit(item)
Exemplo n.º 2
0
def add(form, question_id: str, image=None):
    answer = {
        'id': get_new_id(),
        'submission_time': utils.date_generator(),
        'message': form['message'],
        'question_id': question_id,
        'vote_number': 0,
        'image': form['image']
    }

    DB_answer.add(
        answer)  # put an empty line between variables declaration and methods
Exemplo n.º 3
0
def search(data: str):
    questions_found = []
    questions = (DB_question.search_by_text(data))
    for i in questions:
        questions_found.append(i)
    answers = DB_answer.search_by_text(data)
    for i in answers:
        answer_id = i['id']
        questions_found.append(get(answer_id))

    return questions_found
Exemplo n.º 4
0
def get_new_id():
    return DB_answer.get_last_id() + 1
Exemplo n.º 5
0
def delete(_id):
    DB_answer.delete(_id)
Exemplo n.º 6
0
def get_by_question_with_comments(question_id):
    return DB_answer.get_by_question_with_comments(question_id)
Exemplo n.º 7
0
def get_by_question(question_id: str):
    return DB_answer.get_by_question_id(question_id)
Exemplo n.º 8
0
def get(_id):
    return DB_answer.get_by_id(_id)[0]