testing yuk
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
import supabase from '@/lib/db';
|
||||
|
||||
// GET - Fetch all unique jenis_pendaftaran values
|
||||
// GET - Ambil semua nilai jenis_pendaftaran yang unik
|
||||
export async function GET() {
|
||||
try {
|
||||
// Get all unique jenis_pendaftaran values
|
||||
// Ambil semua nilai jenis_pendaftaran yang unik
|
||||
const { data, error } = await supabase
|
||||
.from('mahasiswa')
|
||||
.select('jenis_pendaftaran')
|
||||
@@ -16,7 +16,7 @@ export async function GET() {
|
||||
return NextResponse.json({ message: 'Internal Server Error' }, { status: 500 });
|
||||
}
|
||||
|
||||
// Get unique values
|
||||
// Ambil nilai unik
|
||||
const uniqueValues = [...new Set(data.map(item => item.jenis_pendaftaran))];
|
||||
|
||||
return NextResponse.json(uniqueValues.map(value => ({ jenis_pendaftaran: value })));
|
||||
@@ -26,13 +26,13 @@ export async function GET() {
|
||||
}
|
||||
}
|
||||
|
||||
// PUT - Update jenis_pendaftaran value
|
||||
// PUT - Update nilai jenis_pendaftaran
|
||||
export async function PUT(request: NextRequest) {
|
||||
try {
|
||||
const body = await request.json();
|
||||
const { oldValue, newValue } = body;
|
||||
|
||||
// Validate required fields
|
||||
// Validasi field yang wajib diisi
|
||||
if (!oldValue || !newValue) {
|
||||
return NextResponse.json(
|
||||
{ message: 'Missing required fields: oldValue, newValue' },
|
||||
|
||||
Reference in New Issue
Block a user