feat: all project setup

This commit is contained in:
ivannoskov
2025-11-10 12:07:24 +03:00
parent fbfd7719bb
commit b0a9934220
99 changed files with 19597 additions and 0 deletions

264
lib/mocks/data/purchases.ts Normal file
View File

@@ -0,0 +1,264 @@
import {
Purchase,
PurchaseDetail,
Subscription,
ViewsSnapshot,
} from "@/lib/types/api";
import { mockTargetChannels } from "./channels";
import { mockExternalChannels } from "./external-channels";
import { mockCreatives } from "./creatives";
// ============================================================================
// Mock Purchases Data
// ============================================================================
export const mockPurchases: Purchase[] = [
{
id: "p1",
target_channel_id: "tc1",
external_channel_id: "ec1",
creative_id: "cr1",
scheduled_date: "2024-03-15T10:00:00.000Z",
actual_date: "2024-03-15T11:30:00.000Z",
cost: 5000,
comment: "Тестовая закупка на утро",
post_link: "https://t.me/marketing_pro/1234",
invite_link: "https://t.me/+AbCdEfGhIjKlMnOp",
invite_link_type: "public",
is_archived: false,
created_at: "2024-03-14T15:00:00.000Z",
updated_at: "2024-03-15T11:30:00.000Z",
target_channel: mockTargetChannels[0],
external_channel: mockExternalChannels[0],
creative: mockCreatives[0],
subscriptions_count: 125,
views_count: 12500,
cpf: 40.0,
cpm: 400.0,
conversion_rate: 1.0,
},
{
id: "p2",
target_channel_id: "tc1",
external_channel_id: "ec2",
creative_id: "cr2",
scheduled_date: "2024-03-18T14:00:00.000Z",
actual_date: "2024-03-18T14:15:00.000Z",
cost: 12000,
comment: "Большой канал, ожидаем хороших результатов",
post_link: "https://t.me/business_startups/5678",
invite_link: "https://t.me/+QrStUvWxYzAbCdEf",
invite_link_type: "public",
is_archived: false,
created_at: "2024-03-17T10:00:00.000Z",
updated_at: "2024-03-18T14:15:00.000Z",
target_channel: mockTargetChannels[0],
external_channel: mockExternalChannels[1],
creative: mockCreatives[1],
subscriptions_count: 210,
views_count: 28000,
cpf: 57.1,
cpm: 428.6,
conversion_rate: 0.75,
},
{
id: "p3",
target_channel_id: "tc2",
external_channel_id: "ec3",
creative_id: "cr3",
scheduled_date: "2024-03-20T16:00:00.000Z",
actual_date: null,
cost: 3500,
comment: null,
post_link: "https://t.me/it_tech_news/9101",
invite_link: "https://t.me/+GhIjKlMnOpQrStUv",
invite_link_type: "private",
is_archived: false,
created_at: "2024-03-19T12:00:00.000Z",
updated_at: "2024-03-19T12:00:00.000Z",
target_channel: mockTargetChannels[1],
external_channel: mockExternalChannels[2],
creative: mockCreatives[2],
subscriptions_count: 85,
views_count: 8500,
cpf: 41.2,
cpm: 411.8,
conversion_rate: 1.0,
},
{
id: "p4",
target_channel_id: "tc1",
external_channel_id: "ec5",
creative_id: "cr1",
scheduled_date: "2024-03-22T12:00:00.000Z",
actual_date: null,
cost: 4500,
comment: "Повторная закупка в том же канале",
post_link: null,
invite_link: "https://t.me/+WxYzAbCdEfGhIjKl",
invite_link_type: "public",
is_archived: false,
created_at: "2024-03-21T09:00:00.000Z",
updated_at: "2024-03-21T09:00:00.000Z",
target_channel: mockTargetChannels[0],
external_channel: mockExternalChannels[4],
creative: mockCreatives[0],
subscriptions_count: 95,
views_count: null,
cpf: 47.4,
cpm: null,
conversion_rate: null,
},
{
id: "p5",
target_channel_id: "tc1",
external_channel_id: "ec1",
creative_id: "cr1",
scheduled_date: "2024-02-10T10:00:00.000Z",
actual_date: "2024-02-10T10:30:00.000Z",
cost: 5500,
comment: "Старая закупка для истории",
post_link: "https://t.me/marketing_pro/1100",
invite_link: "https://t.me/+OldInviteLink123",
invite_link_type: "public",
is_archived: true,
created_at: "2024-02-09T15:00:00.000Z",
updated_at: "2024-02-20T10:00:00.000Z",
target_channel: mockTargetChannels[0],
external_channel: mockExternalChannels[0],
creative: mockCreatives[0],
subscriptions_count: 140,
views_count: 15000,
cpf: 39.3,
cpm: 366.7,
conversion_rate: 0.93,
},
];
// Mock Subscriptions
export const mockSubscriptions: Subscription[] = [
{
id: "s1",
purchase_id: "p1",
telegram_user_id: 111111111,
user_first_name: "Иван",
user_last_name: "Петров",
user_username: "user1",
subscribed_at: "2024-03-15T11:35:00.000Z",
is_active: true,
event_type: "chat_member",
},
{
id: "s2",
purchase_id: "p1",
telegram_user_id: 222222222,
user_first_name: "Мария",
user_last_name: "Сидорова",
user_username: "user2",
subscribed_at: "2024-03-15T11:40:00.000Z",
is_active: true,
event_type: "chat_member",
},
{
id: "s3",
purchase_id: "p1",
telegram_user_id: 333333333,
user_first_name: "Алексей",
user_last_name: null,
user_username: null,
subscribed_at: "2024-03-15T12:00:00.000Z",
is_active: false,
event_type: "join_request",
},
{
id: "s4",
purchase_id: "p2",
telegram_user_id: 444444444,
user_first_name: "Елена",
user_last_name: "Кузнецова",
user_username: "user4",
subscribed_at: "2024-03-18T14:20:00.000Z",
is_active: true,
event_type: "chat_member",
},
{
id: "s5",
purchase_id: "p2",
telegram_user_id: 555555555,
user_first_name: "Дмитрий",
user_last_name: "Смирнов",
user_username: "user5",
subscribed_at: "2024-03-18T14:25:00.000Z",
is_active: true,
event_type: "chat_member",
},
];
// Mock Views Snapshots
export const mockViewsSnapshots: ViewsSnapshot[] = [
{
id: "v1",
purchase_id: "p1",
views: 5000,
fetched_at: "2024-03-15T12:00:00.000Z",
},
{
id: "v2",
purchase_id: "p1",
views: 8500,
fetched_at: "2024-03-15T18:00:00.000Z",
},
{
id: "v3",
purchase_id: "p1",
views: 10200,
fetched_at: "2024-03-16T09:00:00.000Z",
},
{
id: "v4",
purchase_id: "p1",
views: 11800,
fetched_at: "2024-03-16T18:00:00.000Z",
},
{
id: "v5",
purchase_id: "p1",
views: 12500,
fetched_at: "2024-03-17T12:00:00.000Z",
},
{
id: "v6",
purchase_id: "p2",
views: 15000,
fetched_at: "2024-03-18T15:00:00.000Z",
},
{
id: "v7",
purchase_id: "p2",
views: 22000,
fetched_at: "2024-03-18T20:00:00.000Z",
},
{
id: "v8",
purchase_id: "p2",
views: 26500,
fetched_at: "2024-03-19T09:00:00.000Z",
},
{
id: "v9",
purchase_id: "p2",
views: 28000,
fetched_at: "2024-03-19T18:00:00.000Z",
},
];
export const getMockPurchaseDetail = (id: string): PurchaseDetail | null => {
const purchase = mockPurchases.find((p) => p.id === id);
if (!purchase) return null;
return {
...purchase,
subscriptions: mockSubscriptions.filter((s) => s.purchase_id === id),
views_history: mockViewsSnapshots.filter((v) => v.purchase_id === id),
};
};