feat: add Facebook account tracking and management

- Introduced new migration for `facebook_accounts` and `facebook_scrape_logs` tables.
- Updated the scraping logic to handle Facebook accounts, including success and failure tracking.
- Implemented API endpoints for managing Facebook accounts and their scrape logs.
- Enhanced user permissions to restrict access to Facebook account management to admins and super admins.
- Added a dialog component for displaying and managing Facebook accounts in the UI.
- Updated lead fetching logic to include user role checks for assignment and access.
This commit is contained in:
Ace
2026-06-23 14:18:18 +02:00
parent 1adc4806fa
commit ff56cea4b8
25 changed files with 778 additions and 216 deletions
+2 -1
View File
@@ -47,7 +47,8 @@ export async function POST(request: NextRequest) {
if (!user) return NextResponse.json({ error: "Unauthorized" }, { status: 401 })
const { type, title, description, link, userId } = await request.json()
const targetUserId = userId || user.id
const isAdmin = user.role === "admin" || user.role === "super_admin"
const targetUserId = (userId && isAdmin) ? userId : user.id
const result = await query(
`INSERT INTO notifications (user_id, type, title, description, link)