Align backend workbench API with prototype
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
# Backend Workbench Alignment Design
|
||||
|
||||
## Goal
|
||||
|
||||
Align the Go backend with the latest Svelte workbench prototype. The frontend currently models a Discord-like project workbench with dynamic projects, project-scoped channels, and channel-specific first-screen data.
|
||||
|
||||
## API Contract
|
||||
|
||||
Add `GET /api/projects/:id/workspace`.
|
||||
|
||||
The response intentionally matches `apps/web/src/features/workbench/types.ts` and uses camelCase field names:
|
||||
|
||||
- `project`
|
||||
- `channels`
|
||||
- `tags`
|
||||
- `recentSessions`
|
||||
- `inbox`
|
||||
- `tasks`
|
||||
- `aiSessions`
|
||||
- `notesSources`
|
||||
- `cronPlans`
|
||||
|
||||
## Project
|
||||
|
||||
The project payload contains:
|
||||
|
||||
- `id`
|
||||
- `name`
|
||||
- `description`
|
||||
- `initials`
|
||||
- `unreadCount`
|
||||
|
||||
`unreadCount` is the count of open inbox items in the requested project.
|
||||
|
||||
## Channels
|
||||
|
||||
System channels are derived by the backend for every project:
|
||||
|
||||
- `overview`
|
||||
- `inbox`
|
||||
- `tasks`
|
||||
- `ai_sessions`
|
||||
- `notes_sources`
|
||||
- `cron`
|
||||
|
||||
Custom channels are stored in the database as project-scoped URL shortcuts:
|
||||
|
||||
- `title`
|
||||
- `icon`
|
||||
- `url`
|
||||
- `sortOrder`
|
||||
|
||||
System channel counts are derived from project data. Custom channels do not have counts.
|
||||
|
||||
## Channel Data
|
||||
|
||||
The workspace response includes first-screen channel data:
|
||||
|
||||
- Inbox items map to mail-like message rows.
|
||||
- Tasks map to todo-style cards with a `completed` boolean.
|
||||
- AI sessions map to session list rows.
|
||||
- Notes and sources are merged into one attachment/file-management list.
|
||||
- Cron plans are metadata-only scheduled plans.
|
||||
|
||||
Cron plans do not execute autonomous agent work in this MVP.
|
||||
|
||||
## Access Control
|
||||
|
||||
The endpoint only returns a workspace when the authenticated user owns the project. This follows the existing protected router and project dashboard behavior.
|
||||
|
||||
## Tests
|
||||
|
||||
Backend tests should verify:
|
||||
|
||||
- The workspace rejects projects owned by another user.
|
||||
- The workspace returns camelCase fields aligned with the frontend type.
|
||||
- System channel counts are scoped to the requested project.
|
||||
- Custom channels and Cron plans are project-scoped.
|
||||
|
||||
Reference in New Issue
Block a user