improvement for the backend api

This commit is contained in:
ivannoskov
2025-11-19 12:56:04 +03:00
parent b0a9934220
commit d4672ea32b
40 changed files with 2383 additions and 3313 deletions

View File

@@ -1,4 +1,4 @@
import { Creative, CreativeDetail } from "@/lib/types/api";
import { Creative } from "@/lib/types/api";
import { mockTargetChannels } from "./channels";
// ============================================================================
@@ -11,61 +11,39 @@ export const mockCreatives: Creative[] = [
name: 'Креатив "Присоединяйся"',
text: "🔥 Присоединяйся к нашему сообществу!\n\nУзнавай первым о новых возможностях и фишках.\n\n👉 {link}",
target_channel_id: "tc1",
is_archived: false,
target_channel_title: mockTargetChannels[0].title,
created_at: "2024-01-15T10:00:00.000Z",
updated_at: "2024-01-15T10:00:00.000Z",
target_channel: mockTargetChannels[0],
total_purchases: 10,
total_subscriptions: 850,
avg_cpf: 42.3,
status: "active",
placements_count: 10,
},
{
id: "cr2",
name: 'Креатив "Эксклюзив"',
text: "⭐ Эксклюзивный контент только для подписчиков!\n\nНе упусти возможность быть в курсе всех трендов.\n\nПереходи: {link}",
target_channel_id: "tc1",
is_archived: false,
target_channel_title: mockTargetChannels[0].title,
created_at: "2024-01-20T12:00:00.000Z",
updated_at: "2024-01-20T12:00:00.000Z",
target_channel: mockTargetChannels[0],
total_purchases: 5,
total_subscriptions: 400,
avg_cpf: 48.5,
status: "active",
placements_count: 5,
},
{
id: "cr3",
name: 'Креатив "Обучение"',
text: "📚 Хочешь научиться зарабатывать больше?\n\nПодписывайся на канал с проверенными методиками!\n\n{link}",
target_channel_id: "tc2",
is_archived: false,
target_channel_title: mockTargetChannels[1].title,
created_at: "2024-02-05T09:00:00.000Z",
updated_at: "2024-02-05T09:00:00.000Z",
target_channel: mockTargetChannels[1],
total_purchases: 8,
total_subscriptions: 450,
avg_cpf: 52.3,
status: "active",
placements_count: 8,
},
{
id: "cr4",
name: "Старый креатив (архив)",
text: "Устаревший текст с предложением. {link}",
target_channel_id: "tc1",
is_archived: true,
target_channel_title: mockTargetChannels[0].title,
created_at: "2023-12-01T10:00:00.000Z",
updated_at: "2024-01-10T15:00:00.000Z",
target_channel: mockTargetChannels[0],
total_purchases: 2,
total_subscriptions: 80,
avg_cpf: 75.0,
status: "archived",
placements_count: 2,
},
];
export const getMockCreativeDetail = (id: string): CreativeDetail | null => {
const creative = mockCreatives.find((c) => c.id === id);
if (!creative) return null;
return {
...creative,
purchases: [], // Will be populated from purchases mock
};
};