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 - Get all kelompok keahlian
// GET - Ambil semua data kelompok keahlian
export async function GET() {
try {
const { data, error } = await supabase
@@ -27,7 +27,7 @@ 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();
@@ -39,7 +39,7 @@ export async function POST(request: NextRequest) {
);
}
// Check if nama_kelompok already exists
// Cek apakah nama_kelompok sudah ada
const { data: existingData, error: existingError } = await supabase
.from('kelompok_keahlian')
.select('id_kk')
@@ -60,7 +60,7 @@ export async function POST(request: NextRequest) {
);
}
// Insert without specifying id_kk to let the database auto-generate it
// Insert tanpa menentukan id_kk untuk membiarkan database auto-generate
const { data, error } = await supabase
.from('kelompok_keahlian')
.insert([{ nama_kelompok: nama_kelompok.trim() }])
@@ -85,7 +85,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();
@@ -111,7 +111,7 @@ export async function PUT(request: NextRequest) {
);
}
// Check if nama_kelompok already exists for other records
// Cek apakah nama_kelompok sudah ada untuk record lain
const { data: duplicateData, error: duplicateError } = await supabase
.from('kelompok_keahlian')
.select('id_kk')
@@ -158,7 +158,7 @@ export async function PUT(request: NextRequest) {
}
}
// DELETE - Delete kelompok keahlian
// DELETE - Hapus kelompok keahlian
export async function DELETE(request: NextRequest) {
try {
const { searchParams } = new URL(request.url);
@@ -185,8 +185,8 @@ export async function DELETE(request: NextRequest) {
);
}
// Check if kelompok keahlian is being used in other tables
// You might want to add foreign key checks here depending on your database structure
// Cek apakah kelompok keahlian sedang digunakan di tabel lain
// Anda mungkin ingin menambahkan cek foreign key di sini tergantung struktur database
const { error } = await supabase
.from('kelompok_keahlian')