Ejemplo n.º 1
0
def delete_feature_request(feature_request_id):
    feature_request = FeatureRequest.query.filter(
        FeatureRequest.id == feature_request_id).first()
    db.session.delete(feature_request)
    db.session.commit()
    # Should re-prioritize...
    result = reprioritize_feature_requests(
        feature_request.client_id, feature_request.priority,
        (FeatureRequest.nextPriorityByClient(feature_request.client_id) - 1),
        False)
    return jsonify(feature_requests=result)
Ejemplo n.º 2
0
def create_feature_request():
    # Grab the highest priority (for this client).
    initial_priority = FeatureRequest.nextPriorityByClient(
        request.json['client_id'])
    feature_request = FeatureRequest(
        title=request.json['title'],
        product_area=request.json['product_area'],
        target_date=datetime.strptime(request.json['target_date'],
                                      "%Y-%m-%d").date(),
        description=(request.json['description']
                     if 'description' in request.json.keys() else ""),
        priority=initial_priority,
        client_id=request.json['client_id'])
    db.session.add(feature_request)
    db.session.commit()
    id = feature_request.id

    # We'll return all records with adjusted priority.
    return jsonify(feature_requests=reprioritize_feature_requests(
        request.json['client_id'], initial_priority, request.json['priority']))