feat: add Telegram album purchase bot

This commit is contained in:
2026-08-21 18:07:50 +03:30
parent 9478aa319f
commit 1e7b752532
21 changed files with 1399 additions and 459 deletions
+5
View File
@@ -1,6 +1,7 @@
import { NextRequest, NextResponse } from 'next/server';
import { purchaseDb } from '@/lib/db';
import { Purchase } from '@/lib/types';
import { notifyPurchaseApprovers } from '@/lib/telegram';
// GET - Get all purchases
export async function GET(request: NextRequest) {
@@ -54,6 +55,10 @@ export async function POST(request: NextRequest) {
};
const created = purchaseDb.create(purchase);
// Telegram delivery must not make a successfully recorded purchase fail.
void notifyPurchaseApprovers(created).catch((error) => {
console.error('Failed to notify Telegram approvers:', error);
});
return NextResponse.json(created, { status: 201 });
} catch (error) {
console.error('Error creating purchase:', error);