Initial commit - OBS Source Switcher Plugin UI
Complete Next.js application for managing OBS Source Switcher - Stream management with multiple screen layouts - Team management CRUD operations - SQLite database integration - OBS WebSocket API integration - Updated to latest versions (Next.js 15.4.1, React 19.1.0, Tailwind CSS 4.0.0) - Enhanced .gitignore for privacy and development
This commit is contained in:
commit
1d4b1eefba
43 changed files with 9596 additions and 0 deletions
37
app/api/teams/route.ts
Normal file
37
app/api/teams/route.ts
Normal file
|
@ -0,0 +1,37 @@
|
|||
import { NextResponse } from 'next/server';
|
||||
import { getDatabase } from '../../../lib/database';
|
||||
import { Team } from '@/types';
|
||||
import { TABLE_NAMES } from '@/lib/constants';
|
||||
|
||||
export async function GET() {
|
||||
const db = await getDatabase();
|
||||
const teams: Team[] = await db.all(`SELECT * FROM ${TABLE_NAMES.TEAMS}`);
|
||||
return NextResponse.json(teams);
|
||||
}
|
||||
|
||||
export async function POST(request: Request) {
|
||||
try {
|
||||
const { team_name } = await request.json();
|
||||
|
||||
if (!team_name) {
|
||||
return NextResponse.json({ error: 'Team name is required' }, { status: 400 });
|
||||
}
|
||||
|
||||
const db = await getDatabase();
|
||||
|
||||
const result = await db.run(
|
||||
`INSERT INTO ${TABLE_NAMES.TEAMS} (team_name) VALUES (?)`,
|
||||
[team_name]
|
||||
);
|
||||
|
||||
const newTeam: Team = {
|
||||
team_id: result.lastID!,
|
||||
team_name: team_name
|
||||
};
|
||||
|
||||
return NextResponse.json(newTeam, { status: 201 });
|
||||
} catch (error) {
|
||||
console.error('Error creating team:', error);
|
||||
return NextResponse.json({ error: 'Failed to create team' }, { status: 500 });
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue