docs(openspec): add reporting API contract documentation

Add comprehensive API documentation for the reporting endpoint:
- Request/response structure
- View type inference (did/is/will)
- Blank vs explicit zero semantics
- Status values and error responses

Related to enhanced-allocation change.
This commit is contained in:
2026-03-08 18:22:27 -04:00
parent 3324c4f156
commit b7bbfb45c0
27 changed files with 1632 additions and 35 deletions

View File

@@ -9,9 +9,10 @@ import { api } from './api';
export interface Allocation {
id: string;
project_id: string;
team_member_id: string;
team_member_id: string | null;
month: string;
allocated_hours: string;
allocation_indicator?: 'green' | 'yellow' | 'red' | 'gray';
created_at: string;
updated_at: string;
project?: {
@@ -22,7 +23,7 @@ export interface Allocation {
team_member?: {
id: string;
name: string;
};
} | null;
}
export interface CreateAllocationRequest {

View File

@@ -0,0 +1,53 @@
import { api } from '$lib/services/api';
export interface ProjectMonthPlan {
project_id: string;
project_name: string;
approved_estimate: number;
months: Record<string, {
id: string;
planned_hours: number | null;
is_blank: boolean;
} | null>;
plan_sum: number;
reconciliation_status: 'OVER' | 'UNDER' | 'MATCH';
}
export interface ProjectMonthPlansResponse {
data: ProjectMonthPlan[];
meta: {
year: number;
};
}
export interface BulkUpdateRequest {
year: number;
items: Array<{
project_id: string;
month: string;
planned_hours: number | null;
}>;
}
export interface BulkUpdateResponse {
message: string;
summary: {
created: number;
updated: number;
cleared: number;
};
}
class ProjectMonthPlanService {
async getPlans(year: number): Promise<ProjectMonthPlansResponse> {
const response = await api.get<ProjectMonthPlansResponse>(`/project-month-plans?year=${year}`);
return response.data;
}
async bulkUpdate(request: BulkUpdateRequest): Promise<BulkUpdateResponse> {
const response = await api.put<BulkUpdateResponse>('/project-month-plans/bulk', request);
return response.data;
}
}
export const projectMonthPlanService = new ProjectMonthPlanService();