8ad3b97b7e
- Add bot management system with creation, suspension, and reinstatement functionality - Implement autonomous bot posting with scheduling, rate limiting, and content generation - Add content fetching system supporting RSS feeds and multiple content sources - Implement LLM-based content generation with customizable bot personalities - Add mention handling and automated response system for bot interactions - Implement API key management with encryption using AUTH_SECRET for simplified deployment - Add comprehensive bot logging system for activity tracking and error monitoring - Create bot administration pages and settings UI for managing bot configurations - Add database migrations for bot system schema including users, sources, and content items - Implement cron job system for automated bot operations and scheduled tasks - Add extensive test coverage with unit and property-based tests for core bot modules - Simplify encryption by deriving keys from AUTH_SECRET instead of separate environment variable - Implement automatic content fetching on post trigger with retry logic - Add Reddit-specific link preview handling using oEmbed API for reliable metadata extraction - Create utility scripts for bot inspection and cleanup operations - Add comprehensive bot system documentation and improvement tracking
36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
import { NextRequest, NextResponse } from 'next/server';
|
|
import { db } from '@/db';
|
|
import { users } from '@/db';
|
|
import { desc, sql } from 'drizzle-orm';
|
|
|
|
export async function GET(request: NextRequest) {
|
|
try {
|
|
if (!db) {
|
|
return NextResponse.json({ users: [] });
|
|
}
|
|
|
|
const searchParams = request.nextUrl.searchParams;
|
|
const limit = Math.min(parseInt(searchParams.get('limit') || '20'), 50);
|
|
|
|
const userList = await db
|
|
.select({
|
|
id: users.id,
|
|
handle: users.handle,
|
|
displayName: users.displayName,
|
|
bio: users.bio,
|
|
avatarUrl: users.avatarUrl,
|
|
createdAt: users.createdAt,
|
|
isBot: users.isBot,
|
|
})
|
|
.from(users)
|
|
.where(sql`${users.isSuspended} IS FALSE`)
|
|
.orderBy(desc(users.createdAt))
|
|
.limit(limit);
|
|
|
|
return NextResponse.json({ users: userList });
|
|
} catch (error) {
|
|
console.error('List users error:', error);
|
|
return NextResponse.json({ users: [] });
|
|
}
|
|
}
|