feat: global ui & functional update

This commit is contained in:
ivannoskov
2026-01-21 22:43:54 +03:00
parent 8958d89d12
commit 619fd5c1ef
32 changed files with 3803 additions and 1325 deletions

View File

@@ -5,6 +5,7 @@
import { api } from "./client";
import type {
Placement,
PlacementWithStats,
PlacementCreateRequest,
PlacementUpdateRequest,
PlacementsQueryParams,
@@ -23,6 +24,13 @@ export const placementsApi = {
{ params }
),
/**
* Get placements for a specific project (grouped by channel UI)
*/
getByProject: (workspaceId: string, projectId: string) =>
api.get<{ placements: Placement[] }>(`/workspaces/${workspaceId}/projects/${projectId}/placements`)
.then((response) => response.placements),
/**
* Get single placement
*/
@@ -35,6 +43,46 @@ export const placementsApi = {
create: (workspaceId: string, data: PlacementCreateRequest) =>
api.post<Placement>(`/workspaces/${workspaceId}/placements`, data),
/**
* Create placements for multiple channels (bulk creation)
*/
createBulk: (
workspaceId: string,
projectId: string,
data: {
creative_id?: string;
channels: Array<{
username: 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
*/