18 lines
786 B
TypeScript
18 lines
786 B
TypeScript
// GENERATED — do not edit manually.
|
|
|
|
import { buildQuery, post, del, get, put } from './httpClient';
|
|
import type { GoalDo } from '../types/GoalDo';
|
|
|
|
export const goals = {
|
|
create: (athleteId: number | undefined, body: GoalDo): Promise<GoalDo> =>
|
|
post<GoalDo>(`/api/goals${buildQuery({ athleteId })}`, body),
|
|
delete: (id: number): Promise<void> =>
|
|
del<void>(`/api/goals/${id}`),
|
|
getByAthlete: (athleteId?: number): Promise<GoalDo[]> =>
|
|
get<GoalDo[]>(`/api/goals${buildQuery({ athleteId })}`),
|
|
recalculateMetricTotals: (athleteId?: number): Promise<void> =>
|
|
post<void>(`/api/goals/metric-totals/recalculate${buildQuery({ athleteId })}`),
|
|
update: (id: number, body: GoalDo): Promise<GoalDo> =>
|
|
put<GoalDo>(`/api/goals/${id}`, body),
|
|
};
|