feat: purchase-plans update

This commit is contained in:
ivannoskov
2026-02-03 11:14:53 +03:00
parent 6b16bfa6e2
commit d87d6e2568
6 changed files with 179 additions and 35 deletions

View File

@@ -33,10 +33,17 @@ export const placementsApi = {
.then((response) => response.items),
/**
* Get single placement (deprecated - use getInProject for project-specific data)
* Get single placement (requires project_id in original backend)
* Uses: GET /workspaces/{workspace_id}/projects/{project_id}/placements/{placement_id}
*/
get: (workspaceId: string, placementId: string) =>
api.get<Placement>(`/workspaces/${workspaceId}/placements/${placementId}`),
get: (
workspaceId: string,
placementId: string,
projectId?: string
) =>
api.get<Placement>(
`/workspaces/${workspaceId}/projects/${projectId}/placements/${placementId}`
),
/**
* Get single placement within project
@@ -91,6 +98,47 @@ export const placementsApi = {
data
),
/**
* Create single placement within project (bulk format)
* POST /workspaces/{workspace_id}/projects/{project_id}/placements
*/
createInProject: (
workspaceId: string,
projectId: string,
data: {
creative_id?: string;
channels: Array<{
channel_id: string;
status?: string;
comment?: string;
details?: {
placement_at?: string;
payment_at?: string;
cost?: { type: string; value: number };
cost_before_bargain?: number;
placement_type?: string;
format?: string;
comment?: string;
creative_id?: string;
};
}>;
details?: {
placement_at?: string;
payment_at?: string;
cost?: { type: string; value: number };
cost_before_bargain?: number;
placement_type?: string;
format?: string;
comment?: string;
creative_id?: string;
};
}
) =>
api.post<{ placements: Placement[] }>(
`/workspaces/${workspaceId}/projects/${projectId}/placements`,
data
),
/**
* Update placement
*/