feat: admin panel improvements

Header: убрана кнопка Система (дубль Админ), убраны устаревшие импорты
AdminPanel: 6 разделов (AI-провайдеры, Движок, ЮKassa, Расходы AI, Тарифы, Пользователи)
  Тарифы: редактор планов (цена/кредиты/каналы) + стоимость операций
  Движок: ENGINE_PUBLIC_URL, APP_PUBLIC_URL, TELEGRAM_API_BASE, AUTO_DRAFT_*
PlansSection: inline-редактирование тарифов и credit_costs
API routes: /api/admin/plans/[id], /api/admin/credit-costs/[operation]
This commit is contained in:
Ник (Claude)
2026-06-13 00:02:52 +03:00
parent 1fbdc9f9b9
commit a5f6c080bd
4 changed files with 168 additions and 9 deletions
@@ -0,0 +1,17 @@
import { NextResponse } from 'next/server';
import { requireUser } from '@/lib/session';
const ENGINE_URL = process.env.ENGINE_URL || 'http://127.0.0.1:3030';
const ENGINE_SECRET = process.env.ENGINE_SECRET || '';
export async function PATCH(req, { params }) {
const user = await requireUser();
if (!user?.isAdmin) return NextResponse.json({ error: 'Forbidden' }, { status: 403 });
const body = await req.json();
const res = await fetch(`${ENGINE_URL}/api/admin/credit-costs/${params.operation}`, {
method: 'PATCH',
headers: { 'Content-Type': 'application/json', 'x-internal-secret': ENGINE_SECRET, 'x-user-id': String(user.id) },
body: JSON.stringify(body),
});
return NextResponse.json(await res.json());
}
+17
View File
@@ -0,0 +1,17 @@
import { NextResponse } from 'next/server';
import { requireUser } from '@/lib/session';
const ENGINE_URL = process.env.ENGINE_URL || 'http://127.0.0.1:3030';
const ENGINE_SECRET = process.env.ENGINE_SECRET || '';
export async function PATCH(req, { params }) {
const user = await requireUser();
if (!user?.isAdmin) return NextResponse.json({ error: 'Forbidden' }, { status: 403 });
const body = await req.json();
const res = await fetch(`${ENGINE_URL}/api/admin/plans/${params.id}`, {
method: 'PATCH',
headers: { 'Content-Type': 'application/json', 'x-internal-secret': ENGINE_SECRET, 'x-user-id': String(user.id) },
body: JSON.stringify(body),
});
return NextResponse.json(await res.json());
}