Skip to content

feat(import): add JSON bulk import for snippets - #14

Open
KTQ0912 wants to merge 3 commits into
byteofhoney:mainfrom
KTQ0912:fix/issue-8-import-json
Open

feat(import): add JSON bulk import for snippets#14
KTQ0912 wants to merge 3 commits into
byteofhoney:mainfrom
KTQ0912:fix/issue-8-import-json

Conversation

@KTQ0912

@KTQ0912 KTQ0912 commented Jul 25, 2026

Copy link
Copy Markdown

Fixes #8

What changed

  • Add POST /import route that accepts a .json upload and bulk-inserts snippets.
  • Expected JSON shape: array of objects with title, language, code, and optional description and tags.
  • Add Import JSON link in the nav.

Notes

  • Skips entries without title or code.
  • Uses existing make_snippet schema, so imports are consistent with manual entry.

KTQ0912 added 3 commits July 25, 2026 16:07
- Button copies the snippet code directly from the card
- Uses same feedback style as existing copy button on detail page
- Prevents navigation on click to satisfy acceptance criteria

Related to byteofhoney#10
- Add hidden copy source block so copyCardCode can read snippet code
- Keeps copy button behavior robust on index page
- New /import route accepts .json upload and inserts snippets
- Adds Import JSON nav link on base layout
- Creates app/templates/import.html with simple upload form

Fixes byteofhoney#8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Import snippets from JSON

1 participant