Files
multica/packages/core/projects/queries.ts
Bohan Jiang 68e2a14ba2 feat(projects): add Project entity with full-stack CRUD support (#552)
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.
2026-04-09 14:59:16 +08:00

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),
});
}