Skip to content

Feat/Implement New Template wizard on Recipes page (#156)#275

Open
rexx010 wants to merge 2 commits into
Txio-labs:mainfrom
rexx010:feat/156-new-template-wizard
Open

Feat/Implement New Template wizard on Recipes page (#156)#275
rexx010 wants to merge 2 commits into
Txio-labs:mainfrom
rexx010:feat/156-new-template-wizard

Conversation

@rexx010

@rexx010 rexx010 commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #156

Recipes.tsx's "New Template" button only showed an info toast, and the template list was a hardcoded local array with no backing data model, so there was no way to persist a user-created template.

This PR adds a real recipe_templates collection on the backend (same shape/pattern as the existing collections/requests model — repository, service, handler, router, DI-wired in main.rs), and a creation wizard modal on the frontend that calls it. The Recipes page now fetches the user's saved templates on load and merges them with the existing built-in demo templates (kept as non-persisted seed data).

What's included

POST /api/v1/recipe-templates, GET /api/v1/recipe-templates, DELETE /api/v1/recipe-templates/:id (JWT-authed, user-scoped, ownership checked on delete)
NewTemplateModal — name / type / optional description
Recipes.tsx fetches + merges + creates through the wizard

What's explicitly out of scope (flagged in the original issue as a related-but-separate problem)

The "Load" button issue — loading a template still just opens a blank builder tab named after the template. Wiring payload into the PTB/MoveCall builder's actual pre-fill state is a bigger change (touches PTBBuilder.tsx/RPCBuilder.tsx state shape) and is left for a follow-up so this PR stays focused and reviewable.
Deleting/editing a template from the UI — the backend supports delete; no UI affordance was added for it yet.

Testing

Added unit tests for the new DTO validation (recipe_template_dtos.rs), the new API client methods (api.test.ts), and the wizard component (NewTemplateModal.test.tsx). All run fully offline — no Docker/Mongo needed for cargo test or npm run test.
Not added: integration tests that exercise RecipeTemplateRepository against a real Mongo instance. This mirrors the existing Collection/ SavedRequest code, which also has no DB-hitting tests in this repo — only pure-logic tests (e.g. validate_url). Adding a DB-integration test harness (e.g. testcontainers) is a real gap worth closing, but it's a testing-infrastructure decision that affects the whole codebase, not just this feature, so it's left out of this PR rather than introduced unilaterally alongside it. Happy to follow up separately if maintainers want it.

rexx010 added 2 commits July 25, 2026 17:59
Add RecipeTemplate model, repository, service, handler, router, and DTO validation tests, mirroring the existing Collection pattern. Mount at /api/v1/recipe-templates (POST/GET/DELETE, JWT-authed, user-scoped).

Refs Txio-labs#156
Add RecipeTemplate type, API client methods, and tests. Add NewTemplateModal wizard (name, type, description) with tests. Wire Recipes.tsx to fetch persisted templates on load, merge with existing built-in seed templates, and create real templates through the wizard instead of a toast.

Fixes Txio-labs#156
@vercel

vercel Bot commented Jul 25, 2026

Copy link
Copy Markdown

@rexx010 is attempting to deploy a commit to the oladimejivictor611-5012's projects Team on Vercel.

A member of the Team first needs to authorize it.

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.

Feature request: implement the New Template wizard on the Recipes page

1 participant