Skip to content

Commit

Permalink
Adding delivery + new modification bp + updating database structure
Browse files Browse the repository at this point in the history
  • Loading branch information
paulstretenowich committed Jun 18, 2024
1 parent 9037375 commit ff239f0
Show file tree
Hide file tree
Showing 12 changed files with 1,049 additions and 414 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ build/
*.egg-info/

.DS_Store

tests/data/real_data
4 changes: 2 additions & 2 deletions project_tracking/api/__init__.py
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)
101 changes: 101 additions & 0 deletions project_tracking/api/modification.py
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)
Loading

0 comments on commit ff239f0

Please sign in to comment.