mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-14 01:50:39 +09:00
Server: - companyService.stats() returns per-company agent/issue counts in one query pair - companyService.remove() cascades deletes across all child tables in dependency order - GET /companies/stats endpoint (board-accessible) - DELETE /companies/:companyId endpoint (board-only) UI: - Companies page shows agent count, issue count, spend/budget, and created-at per card - Company status shown as a colored badge (active/paused/archived) - Three-dot dropdown menu with Rename and Delete Company actions - Inline delete confirmation to prevent accidental data loss - 'New Company' button opens onboarding wizard instead of inline form Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
18 lines
889 B
TypeScript
18 lines
889 B
TypeScript
import type { Company } from "@paperclip/shared";
|
|
import { api } from "./client";
|
|
|
|
export type CompanyStats = Record<string, { agentCount: number; issueCount: number }>;
|
|
|
|
export const companiesApi = {
|
|
list: () => api.get<Company[]>("/companies"),
|
|
get: (companyId: string) => api.get<Company>(`/companies/${companyId}`),
|
|
stats: () => api.get<CompanyStats>("/companies/stats"),
|
|
create: (data: { name: string; description?: string | null; budgetMonthlyCents?: number }) =>
|
|
api.post<Company>("/companies", data),
|
|
update: (
|
|
companyId: string,
|
|
data: Partial<Pick<Company, "name" | "description" | "status" | "budgetMonthlyCents">>,
|
|
) => api.patch<Company>(`/companies/${companyId}`, data),
|
|
archive: (companyId: string) => api.post<Company>(`/companies/${companyId}/archive`, {}),
|
|
remove: (companyId: string) => api.delete<{ ok: true }>(`/companies/${companyId}`),
|
|
};
|