Fixed StationSelectBug, Fixed HPGNotificationGuf, see #45
This commit is contained in:
@@ -3,6 +3,11 @@ import { Prisma, prisma } from "@repo/db";
|
||||
|
||||
export async function GET(request: NextRequest): Promise<NextResponse> {
|
||||
try {
|
||||
const config = await prisma.config.findFirst({
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
});
|
||||
const filter = JSON.parse(
|
||||
new URL(request.url).searchParams.get("filter") || "{}",
|
||||
) as Prisma.ConnectedAircraftWhereInput;
|
||||
@@ -16,9 +21,15 @@ export async function GET(request: NextRequest): Promise<NextResponse> {
|
||||
Station: true,
|
||||
},
|
||||
});
|
||||
return NextResponse.json(connectedAircraft, {
|
||||
status: 200,
|
||||
});
|
||||
return NextResponse.json(
|
||||
connectedAircraft.map((a) => ({
|
||||
...a,
|
||||
posH145active: config?.disableHPG ? false : a.posH145active,
|
||||
})),
|
||||
{
|
||||
status: 200,
|
||||
},
|
||||
);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
return NextResponse.json({ error: "Failed to fetch Aircrafts" }, { status: 500 });
|
||||
|
||||
Reference in New Issue
Block a user