Spaces:
Running
Running
| import { api } from "./client"; | |
| import type { CapacityWeek, Dashboard, ProjectAllocationRow, UtilizationRow } from "../types"; | |
| export const getDashboard = async () => (await api.get<Dashboard>("/dashboard")).data; | |
| export const getUtilization = async (start: string, end: string) => | |
| (await api.get<UtilizationRow[]>("/reports/utilization", { params: { start, end } })).data; | |
| export const getCapacity = async (start: string, end: string) => | |
| (await api.get<CapacityWeek[]>("/reports/capacity", { params: { start, end } })).data; | |
| export const getAvailability = async (start: string, end: string) => | |
| (await api.get<UtilizationRow[]>("/reports/availability", { params: { start, end } })).data; | |
| export const getOverallocated = async (start: string, end: string) => | |
| (await api.get<UtilizationRow[]>("/reports/overallocated", { params: { start, end } })).data; | |
| export const getProjectAllocation = async (start: string, end: string) => | |
| (await api.get<ProjectAllocationRow[]>("/reports/project-allocation", { params: { start, end } })).data; | |
| export interface PeopleWeeklyAvailability { | |
| weeks: string[]; | |
| people: Array<{ | |
| person_id: number; | |
| name: string; | |
| role: string | null; | |
| team: string | null; | |
| avatar_color: string; | |
| weekly_capacity_hrs: number; | |
| weeks: Array<{ | |
| week_start: string; | |
| available_hours: number; | |
| allocated_hours: number; | |
| tentative_hours: number; | |
| utilization_pct: number; | |
| }>; | |
| }>; | |
| } | |
| export const getPeopleWeeklyAvailability = async (start: string, end: string) => | |
| ( | |
| await api.get<PeopleWeeklyAvailability>("/reports/people-weekly-availability", { | |
| params: { start, end }, | |
| }) | |
| ).data; | |
| export interface PeopleDailyAvailability { | |
| days: string[]; | |
| people: Array<{ | |
| person_id: number; | |
| name: string; | |
| role: string | null; | |
| team: string | null; | |
| avatar_color: string; | |
| weekly_capacity_hrs: number; | |
| days: Array<{ | |
| date: string; | |
| available_hours: number; | |
| allocated_hours: number; | |
| tentative_hours: number; | |
| utilization_pct: number; | |
| }>; | |
| }>; | |
| } | |
| export const getPeopleDailyAvailability = async (start: string, end: string) => | |
| ( | |
| await api.get<PeopleDailyAvailability>("/reports/people-daily-availability", { | |
| params: { start, end }, | |
| }) | |
| ).data; | |