mirror of
https://github.com/multica-ai/multica.git
synced 2026-06-17 03:38:32 +02:00
Implements the Project concept as a higher-level grouping for issues. Hierarchy: workspace → project → issue → sub-issue. Backend: - Migration 034: project table + issue.project_id FK - sqlc queries for project CRUD - Project handler with list/get/create/update/delete - Issue handler updated to support project_id in create/update - Routes at /api/projects, WebSocket event constants Frontend (new monorepo structure): - @multica/core: Project types, API client methods, queries/mutations, status config, realtime sync - @multica/views: Projects list page, detail page (overview + issues tabs), project picker for issue detail panel - apps/web: Route pages, sidebar navigation entry All TypeScript type checks and tests pass.
25 lines
716 B
TypeScript
25 lines
716 B
TypeScript
import { queryOptions } from "@tanstack/react-query";
|
|
import { api } from "../api";
|
|
|
|
export const projectKeys = {
|
|
all: (wsId: string) => ["projects", wsId] as const,
|
|
list: (wsId: string) => [...projectKeys.all(wsId), "list"] as const,
|
|
detail: (wsId: string, id: string) =>
|
|
[...projectKeys.all(wsId), "detail", id] as const,
|
|
};
|
|
|
|
export function projectListOptions(wsId: string) {
|
|
return queryOptions({
|
|
queryKey: projectKeys.list(wsId),
|
|
queryFn: () => api.listProjects(),
|
|
select: (data) => data.projects,
|
|
});
|
|
}
|
|
|
|
export function projectDetailOptions(wsId: string, id: string) {
|
|
return queryOptions({
|
|
queryKey: projectKeys.detail(wsId, id),
|
|
queryFn: () => api.getProject(id),
|
|
});
|
|
}
|