-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding delivery + new modification bp + updating database structure
- Loading branch information
1 parent
9037375
commit ff239f0
Showing
12 changed files
with
1,049 additions
and
414 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,5 @@ build/ | |
*.egg-info/ | ||
|
||
.DS_Store | ||
|
||
tests/data/real_data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
from . import admin, project | ||
from . import admin, project, modification | ||
|
||
blueprints = (admin.bp, project.bp) | ||
blueprints = (admin.bp, project.bp, modification.bp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
import logging | ||
import functools | ||
|
||
from flask import Blueprint, jsonify, request, flash, redirect, json, abort | ||
|
||
from .. import db_action | ||
from .. import vocabulary as vc | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
bp = Blueprint('modification', __name__, url_prefix='/modification') | ||
|
||
@bp.route('/edit', methods=['POST']) | ||
def edit(): | ||
""" | ||
POST: json describing the edit to be made | ||
return: | ||
""" | ||
if request.method == 'POST': | ||
try: | ||
ingest_data = request.get_json(force=True) | ||
except: | ||
flash('Data does not seems to be json') | ||
return redirect(request.url) | ||
|
||
return db_action.edit(ingest_data) | ||
|
||
@bp.route('/delete', methods=['POST']) | ||
def delete(): | ||
""" | ||
POST: json describing the delete to be made | ||
return: | ||
""" | ||
if request.method == 'POST': | ||
try: | ||
ingest_data = request.get_json(force=True) | ||
except: | ||
flash('Data does not seems to be json') | ||
return redirect(request.url) | ||
|
||
return db_action.delete(ingest_data) | ||
|
||
@bp.route('/undelete', methods=['POST']) | ||
def undelete(): | ||
""" | ||
POST: json describing the undelete to be made | ||
return: | ||
""" | ||
if request.method == 'POST': | ||
try: | ||
ingest_data = request.get_json(force=True) | ||
except: | ||
flash('Data does not seems to be json') | ||
return redirect(request.url) | ||
|
||
return db_action.undelete(ingest_data) | ||
|
||
@bp.route('/deprecate', methods=['POST']) | ||
def deprecate(): | ||
""" | ||
POST: json describing the deprecate to be made | ||
return: | ||
""" | ||
if request.method == 'POST': | ||
try: | ||
ingest_data = request.get_json(force=True) | ||
except: | ||
flash('Data does not seems to be json') | ||
return redirect(request.url) | ||
|
||
return db_action.deprecate(ingest_data) | ||
|
||
@bp.route('/undeprecate', methods=['POST']) | ||
def undeprecate(): | ||
""" | ||
POST: json describing the undeprecate to be made | ||
return: | ||
""" | ||
if request.method == 'POST': | ||
try: | ||
ingest_data = request.get_json(force=True) | ||
except: | ||
flash('Data does not seems to be json') | ||
return redirect(request.url) | ||
|
||
return db_action.undeprecate(ingest_data) | ||
|
||
@bp.route('/curate', methods=['POST']) | ||
def curate(): | ||
""" | ||
POST: json describing the curate to be made | ||
return: | ||
""" | ||
if request.method == 'POST': | ||
try: | ||
ingest_data = request.get_json(force=True) | ||
except: | ||
flash('Data does not seems to be json') | ||
return redirect(request.url) | ||
|
||
return db_action.curate(ingest_data) |
Oops, something went wrong.