testing yuk

This commit is contained in:
Randa Firman Putra
2025-09-14 16:59:31 +07:00
parent 248fed0d0b
commit 60211ae829
63 changed files with 315 additions and 315 deletions

View File

@@ -1,7 +1,7 @@
import { NextRequest, NextResponse } from "next/server";
import supabase from "@/lib/db";
// GET - Fetch all kelompok keahlian
// GET - Ambil semua data kelompok keahlian
export async function GET() {
try {
const { data, error } = await supabase
@@ -23,12 +23,12 @@ export async function GET() {
}
}
// POST - Create new kelompok keahlian
// POST - Buat kelompok keahlian baru
export async function POST(request: NextRequest) {
try {
const { nama_kelompok } = await request.json();
// Validation
// Validasi
if (!nama_kelompok) {
return NextResponse.json(
{ error: "nama_kelompok is required" },
@@ -36,7 +36,7 @@ export async function POST(request: NextRequest) {
);
}
// Check if nama_kelompok already exists
// Cek apakah nama_kelompok sudah ada
const { data: existingKelompok, error: checkError } = await supabase
.from('kelompok_keahlian')
.select('id_kk')
@@ -74,7 +74,7 @@ export async function POST(request: NextRequest) {
}
}
// PUT - Update kelompok keahlian
// PUT - Update data kelompok keahlian
export async function PUT(request: NextRequest) {
try {
const { id_kk, nama_kelompok } = await request.json();
@@ -87,7 +87,7 @@ export async function PUT(request: NextRequest) {
);
}
// Check if kelompok keahlian exists
// Cek apakah kelompok keahlian ada
const { data: existingKelompok, error: checkError } = await supabase
.from('kelompok_keahlian')
.select('id_kk')
@@ -105,7 +105,7 @@ export async function PUT(request: NextRequest) {
);
}
// Check if nama_kelompok already exists for another kelompok
// Cek apakah nama_kelompok sudah ada untuk kelompok lain
const { data: duplicateNama, error: duplicateError } = await supabase
.from('kelompok_keahlian')
.select('id_kk')