This PR implements the ability to edit the start time of a customized, scheduled money stream before it begins vesting. Previously, if users made a mistake with the start time, they were forced to fully cancel the stream and complete the creation flow over again from scratch.
This feature encompasses a new set of targeted updates across the full stack (UI, Service layer, and Backend Controller), adding flexible editing strictly gated to upcoming/scheduled streams.
- Endpoint: Added a new
PATCH /api/streams/:id/start-timeendpoint that processes UNIX timestamp updates. - Validation: Enforces strict domain constraints on the server — requests to edit the timestamp of streams that are
active,completed, orcanceledare safely rejected with HTTP 422 HTTP responses. - Swagger: Full OpenAPI definitions written for the new endpoint in
swagger.ts. - Typing Fixes: Fixed severe build-blocking TypeScript configuration issues involving Node globally (
process) andcors/expresstype dependencies across the backend.
- API Client Hook: Exposed
updateStreamStartAt(id, startAt)insideservices/api.ts. - Dedicated Modal Component (
EditStartTimeModal.tsx):- Utilizes native accessible HTML5
<input type="datetime-local">to provide a clean date-picker experience that automatically adheres to localized formats. - Features real-time validation to restrict timestamps strictly to the future and correctly parses the UNIX epoch behind the scenes.
- Utilizes native accessible HTML5
- Stream Table Integration (
StreamsTable.tsx):- Dynamically evaluates each stream and injects an active ✏️ Edit button alongside the Cancel button via a new
action-cellcontainer pattern. - Gated completely to
scheduledstreams so users aren't confused by invalid actions on running streams.
- Dynamically evaluates each stream and injects an active ✏️ Edit button alongside the Cancel button via a new
- App State & Real-time Sync (
App.tsx):- Subscribes the modal interface to the core application state loop so streams automatically update and reflect correctly in the global index and tables as soon as a
submitexecutes.
- Subscribes the modal interface to the core application state loop so streams automatically update and reflect correctly in the global index and tables as soon as a
- Scheduled streams can be updated successfully.
- Active/completed/canceled streams return proper validation error and are impossible to invoke via UI.
- Updated start time appears immediately in the UI.
- Restart both backend and frontend environments (
npm run dev). - Construct a stream that is scheduled to launch far into the future.
- Observe that only the scheduled stream allows the
✏️ Editbutton to be pressed from the "Actions" cell inside the central stream table. - Select a new date within the native popup that is closer to the current time, submit, and observe the UI dynamically adjust the record globally in seconds.
- Attempt backend circumvention by issuing a
PATCH /api/streams/:id/start-timefor a currentlyactiveorcanceledstream. Observe the resulting422entity validation error returned natively.