Feat/Implement New Template wizard on Recipes page (#156)#275
Open
rexx010 wants to merge 2 commits into
Open
Conversation
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
|
@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. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.