Ник (Claude)
ce74ac9909
feat: promo codes system
...
DB: promo_codes, promo_usages tables
routes/admin.js: CRUD /api/admin/promos (GET/POST/PATCH/DELETE)
routes/billing.js: POST /api/billing/apply-promo
Валидация: exists, active, not expired, not exhausted, not used by this user
type=credits → начисляет через billing.credit()
2026-06-13 09:36:32 +03:00
Ник (Claude)
f18b83c59b
feat: admin dashboard API + separate admin routes file
...
routes/admin.js: GET /dashboard, /users, POST /credit, PATCH /plans/:id, /credit-costs/:op
index.js: app.use('/api/admin', adminRoutes) — чистый монтаж без хаков
dashboard: users (total/7d/30d), channels by platform, posts (total/today/week),
revenue (YuKassa), AI costs (30d), registrations chart (14d), pending drafts alert
2026-06-13 00:09:53 +03:00
Ник (Claude)
ad9f054701
feat: admin panel — plans editor + credit costs editor
...
routes/billing.js: PATCH /api/admin/plans/:id, PATCH /api/admin/credit-costs/:operation
index.js: /api/admin/* → billing routes
DB: AI_IMAGE_* → category=legacy (скрыты из UI)
engine settings: ENGINE_PUBLIC_URL, APP_PUBLIC_URL, AUTO_DRAFT_DEFAULT_*
2026-06-13 00:02:03 +03:00
Ник (Claude)
4580264de9
feat: yukassa reads keys from app_settings + monthly reset endpoint
...
- yukassa.js: getConfig() читает YUKASSA_SHOP_ID/SECRET/RETURN_URL из app_settings (fallback env)
- routes/billing.js: POST /monthly-reset — запускает processMonthlyResets()
- app_settings: категория 'payments' с ключами ЮKassa
- cron: 0 6 * * * zeropost-billing-reset.sh
2026-06-11 19:40:10 +03:00
Ник (Claude)
9baa0f0959
feat: YuKassa payment integration
...
- services/yukassa.js: createPayment, handleWebhook
createPayment → создаёт платёж + сохраняет в payment_orders
handleWebhook → activates plan + charges credits on payment.succeeded
- routes/billing.js: POST /checkout, POST /webhook (публичный)
- DB: payment_orders table
- index.js: /api/billing/webhook публичный (до auth middleware)
2026-06-11 18:44:20 +03:00
Ник (Claude)
2e60a6e316
feat: billing system — credits, plans, transactions
...
DB:
- plans: free/starter/pro/business с ценами и лимитами
- user_subscriptions: подписка пользователя на план
- user_balance: баланс кредитов + monthly reset
- user_transactions: история всех движений кредитов
- credit_costs: image=5, text_post=2, article=5, autopublish=0
Engine:
- services/billing.js: getBalance, check, spend, credit, getTransactions, processMonthlyResets
- routes/billing.js: GET /balance, /transactions, /plans, POST /admin/credit, GET /admin/users
- routes/generate.js: списание кредитов перед генерацией (text_post, article, image)
- index.js: GET /api/billing/plans публично (без auth)
2026-06-11 18:26:38 +03:00