feat: bootstrap taller-turnos project
Estructura inicial con Next.js 14, PostgreSQL/Prisma 7, autenticación por magic link (clientes) y JWT (admins), lógica de scheduling con 4 slots paralelos y API routes completas para cliente y panel admin. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { prisma } from "@/lib/prisma";
|
||||
import { verificarSesion } from "@/lib/auth-admin";
|
||||
|
||||
export async function PATCH(req: NextRequest, { params }: { params: Promise<{ id: string }> }) {
|
||||
const sesion = await verificarSesion("admin_session");
|
||||
if (!sesion) return NextResponse.json({ error: "No autorizado" }, { status: 401 });
|
||||
|
||||
const { id } = await params;
|
||||
const data = await req.json();
|
||||
|
||||
const servicio = await prisma.tipoServicio.update({
|
||||
where: { id },
|
||||
data: {
|
||||
...(data.nombre !== undefined && { nombre: data.nombre }),
|
||||
...(data.duracionHoras !== undefined && { duracionHoras: Number(data.duracionHoras) }),
|
||||
...(data.activo !== undefined && { activo: data.activo }),
|
||||
},
|
||||
});
|
||||
|
||||
return NextResponse.json(servicio);
|
||||
}
|
||||
Reference in New Issue
Block a user