Skip to content

Commit

Permalink
added new route for raw record data
Browse files Browse the repository at this point in the history
  • Loading branch information
Jin-Sun-tts committed Oct 22, 2024
1 parent 8821bb6 commit 618b5aa
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from . import htmx
from .forms import HarvestSourceForm, OrganizationForm
from .paginate import Pagination
import json

logger = logging.getLogger("harvest_admin")

Expand Down Expand Up @@ -731,6 +732,17 @@ def get_harvest_record(record_id=None):

return db._to_dict(record)

@mod.route("/harvest_record/raw/<record_id>", methods=["GET"])
def get_harvest_record_raw(record_id=None):
record = db.get_harvest_record(record_id)
if record:
try:
source_raw_json = json.loads(record.source_raw)
return source_raw_json, 200
except json.JSONDecodeError:
return {"error": "Invalid JSON format in source_raw"}, 500
else:
return {"error": "Not Found"}, 404

### Add record
@mod.route("/harvest_record/add", methods=["POST", "GET"])
Expand Down

1 comment on commit 618b5aa

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests Skipped Failures Errors Time
2 0 💤 0 ❌ 0 🔥 8.060s ⏱️

Please sign in to comment.