19 lines
408 B
TypeScript
19 lines
408 B
TypeScript
import { prisma } from "@/lib/prisma"
|
|
import { NextResponse } from "next/server"
|
|
import bcrypt from "bcryptjs"
|
|
|
|
export async function POST(req: Request) {
|
|
const body = await req.json()
|
|
|
|
const defaultPassword = await bcrypt.hash("muller123", 10)
|
|
|
|
const worker = await prisma.worker.create({
|
|
data: {
|
|
...body,
|
|
password: defaultPassword
|
|
}
|
|
})
|
|
|
|
return NextResponse.json(worker)
|
|
}
|