curl --request GET \
--url https://api.example.com/api/projects{
"projects": [
{
"projects[].id": "<string>",
"projects[].workspaceId": "<string>",
"projects[].userId": "<string>",
"projects[].name": "<string>",
"projects[].styleTemplateId": "<string>",
"projects[].roomType": {},
"projects[].thumbnailUrl": {},
"projects[].status": "<string>",
"projects[].imageCount": 123,
"projects[].completedCount": 123,
"projects[].createdAt": "<string>",
"projects[].updatedAt": "<string>"
}
]
}Retrieve all projects for the authenticated user’s workspace
curl --request GET \
--url https://api.example.com/api/projects{
"projects": [
{
"projects[].id": "<string>",
"projects[].workspaceId": "<string>",
"projects[].userId": "<string>",
"projects[].name": "<string>",
"projects[].styleTemplateId": "<string>",
"projects[].roomType": {},
"projects[].thumbnailUrl": {},
"projects[].status": "<string>",
"projects[].imageCount": 123,
"projects[].completedCount": 123,
"projects[].createdAt": "<string>",
"projects[].updatedAt": "<string>"
}
]
}20limit for paginated results.Example: 0pending - Projects with no processed imagesprocessing - Projects with images currently being processedcompleted - Projects where all images are completedfailed - Projects where all images failedGET /api/projects?limit=10&offset=0&status=completed
living-room, bedroom, kitchen).pending - No images processed yetprocessing - At least one image is being processedcompleted - All images completed successfullyfailed - All images failed to process[
{
"id": "a1b2c3d4-5678-90ab-cdef-1234567890ab",
"workspaceId": "ws_abc123",
"userId": "user_xyz789",
"name": "Sunset Villa - Master Bedroom",
"styleTemplateId": "modern-scandinavian",
"roomType": "bedroom",
"thumbnailUrl": "https://storage.example.com/thumbnails/abc123.jpg",
"status": "completed",
"imageCount": 5,
"completedCount": 5,
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T11:45:00.000Z"
},
{
"id": "b2c3d4e5-6789-01bc-def2-234567890abc",
"workspaceId": "ws_abc123",
"userId": "user_xyz789",
"name": "Downtown Condo - Kitchen Renovation",
"styleTemplateId": "minimalist-white",
"roomType": "kitchen",
"thumbnailUrl": "https://storage.example.com/thumbnails/def456.jpg",
"status": "processing",
"imageCount": 8,
"completedCount": 3,
"createdAt": "2024-01-14T09:15:00.000Z",
"updatedAt": "2024-01-14T10:22:00.000Z"
},
{
"id": "c3d4e5f6-7890-12cd-ef34-34567890abcd",
"workspaceId": "ws_abc123",
"userId": "user_xyz789",
"name": "Mountain Retreat - Exterior",
"styleTemplateId": "rustic-modern",
"roomType": "exterior",
"thumbnailUrl": null,
"status": "pending",
"imageCount": 0,
"completedCount": 0,
"createdAt": "2024-01-13T14:20:00.000Z",
"updatedAt": "2024-01-13T14:20:00.000Z"
}
]
createdAt DESC (newest first)SELECT * FROM project
WHERE workspace_id = $workspaceId
AND ($status IS NULL OR status = $status)
ORDER BY created_at DESC
LIMIT $limit OFFSET $offset;
workspace_id, status, and created_at columnsimageCount and completedCount are pre-calculated for fast readslimit and offset for large datasets to reduce payload sizegetProjectStats query:
const stats = await getProjectStats(workspaceId);
// Returns:
{
totalProjects: 45,
completedProjects: 38,
processingProjects: 5,
totalImages: 342
}
/lib/db/queries.ts:updateProjectCounts (lines 404-516).
DELETE /api/projects/:id/app/dashboard/page.tsx:getProjects (line 30)/lib/db/queries.ts:getProjects (lines 279-305)/lib/db/queries.ts:getProjectStats (lines 333-372)/lib/db/schema.ts:project (lines 164-196)