Initial commit - ERP System

This commit is contained in:
root
2026-05-20 18:58:23 +00:00
commit e174936997
2697 changed files with 1628427 additions and 0 deletions
@@ -0,0 +1,38 @@
import { NextResponse } from 'next/server';
import prisma from '../../../../../lib/prisma';
export async function POST(request: Request, context: { params: Promise<{ id: string }> }) {
try {
const params = await context.params;
const data = await request.json();
const credential = await prisma.customerCredential.create({
data: {
customerId: parseInt(params.id),
title: data.title,
username: data.username,
password: data.password
}
});
return NextResponse.json(credential);
} catch (error) {
return NextResponse.json({ error: 'Erstellen fehlgeschlagen' }, { status: 500 });
}
}
export async function DELETE(request: Request, context: { params: Promise<{ id: string }> }) {
try {
const { searchParams } = new URL(request.url);
const credId = searchParams.get('credId');
if (!credId) return NextResponse.json({ error: 'ID fehlt' }, { status: 400 });
await prisma.customerCredential.delete({
where: { id: parseInt(credId) }
});
return NextResponse.json({ success: true });
} catch (error) {
return NextResponse.json({ error: 'Löschen fehlgeschlagen' }, { status: 500 });
}
}