Skip to content

feat(templates): implement stream template system (#596)#4

Open
fytgian wants to merge 1 commit into
mainfrom
feature/596-stream-templates
Open

feat(templates): implement stream template system (#596)#4
fytgian wants to merge 1 commit into
mainfrom
feature/596-stream-templates

Conversation

@fytgian

@fytgian fytgian commented Jun 26, 2026

Copy link
Copy Markdown
Owner

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 load
  • api/routes/streamTemplates.js — 8 REST endpoints with express-validator and swagger JSDoc

Modified files

  • api/server.js — Mounts /v1/api/stream-templates behind authMiddleware

API Endpoints

Method Path Description
POST /v1/api/stream-templates Create template from scratch
POST /v1/api/stream-templates/from-stream Save existing stream params as template
GET /v1/api/stream-templates List own + shared + default templates
GET /v1/api/stream-templates/:id Get single template
PATCH /v1/api/stream-templates/:id Modify name, params, or shared flag
DELETE /v1/api/stream-templates/:id Delete template (own non-default only)
POST /v1/api/stream-templates/:id/share Toggle team sharing
POST /v1/api/stream-templates/:id/create-stream Instantiate stream from template

Acceptance Criteria

Criterion Status
Template creation from stream POST /from-stream strips employer/employee, saves reusable params
Template listing GET / returns own + shared + defaults
Create stream from template POST /:id/create-stream with optional overrides object
Template modification PATCH /:id — name, params, shared
Template deletion DELETE /:id — owner-only, protects default templates
Sharing templates with team POST /:id/share + shared templates visible to all users in listing
Default templates library ✅ 2 defaults seeded: Monthly Salary USDC, Weekly Contractor USDC

- 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
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.

Create Stream Template System

1 participant