fix: jabatan
Deskripsi; - order by name jabatan No Issues'
This commit is contained in:
@@ -68,11 +68,14 @@ export async function GET(request: Request) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const allData = positions.map((v: any) => ({
|
const allData = positions.map((v: any) => ({
|
||||||
..._.omit(v, ["Group"]),
|
..._.omit(v, ["Group", "name"]),
|
||||||
|
name: v.name,
|
||||||
group: v.Group.name
|
group: v.Group.name
|
||||||
}))
|
}))
|
||||||
|
|
||||||
return NextResponse.json({ success: true, message: "Berhasil mendapatkan jabatan", data: allData, filter }, { status: 200 });
|
const dataFix = _.orderBy(allData, [data => data.name.toLowerCase()], ['asc']);
|
||||||
|
|
||||||
|
return NextResponse.json({ success: true, message: "Berhasil mendapatkan jabatan", data: dataFix, filter }, { status: 200 });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan jabatan, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mendapatkan jabatan, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
|
||||||
|
|||||||
Reference in New Issue
Block a user