feat(templates): implement stream template system (#596)#4
Open
fytgian wants to merge 1 commit into
Open
Conversation
- templateService: in-memory CRUD, createFromStream (strips employer/employee), share toggle, owner-scoped list that includes shared+default templates, seeded default templates (Monthly Salary USDC, Weekly Contractor USDC) - streamTemplates router: POST /stream-templates (create), GET (list), GET /:id, PATCH /:id (update), DELETE /:id, POST /:id/share, POST /:id/create-stream (instantiate with optional overrides) - server.js: mount /v1/api/stream-templates behind authMiddleware
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 Vera3289#596
Builds a complete stream template system: employers can save stream configurations as named templates, share them with their team, and instantiate streams directly from a template.
Changes
New files
api/services/templateService.js— In-memory store with full CRUD,createFromStream(strips runtime fields employer/employee, keeps reusable params), owner-scoped listing that includes shared + default templates, share toggle, and 2 built-in default templates seeded at module loadapi/routes/streamTemplates.js— 8 REST endpoints with express-validator and swagger JSDocModified files
api/server.js— Mounts/v1/api/stream-templatesbehindauthMiddlewareAPI Endpoints
POST/v1/api/stream-templatesPOST/v1/api/stream-templates/from-streamGET/v1/api/stream-templatesGET/v1/api/stream-templates/:idPATCH/v1/api/stream-templates/:idDELETE/v1/api/stream-templates/:idPOST/v1/api/stream-templates/:id/sharePOST/v1/api/stream-templates/:id/create-streamAcceptance Criteria
POST /from-streamstrips employer/employee, saves reusable paramsGET /returns own + shared + defaultsPOST /:id/create-streamwith optionaloverridesobjectPATCH /:id— name, params, sharedDELETE /:id— owner-only, protects default templatesPOST /:id/share+ shared templates visible to all users in listing