import
This commit is contained in:
@@ -1,10 +1,41 @@
|
|||||||
import { Router } from "express";
|
import { Router } from "express";
|
||||||
import mailRouter from "./mail";
|
import mailRouter from "./mail";
|
||||||
import eventRouter from "./event";
|
import eventRouter from "./event";
|
||||||
|
import DATA from "./var.Station.json";
|
||||||
|
import { Country, prisma } from "@repo/db";
|
||||||
|
|
||||||
const router: Router = Router();
|
const router: Router = Router();
|
||||||
|
|
||||||
router.use("/mail", mailRouter);
|
router.use("/mail", mailRouter);
|
||||||
router.use("/event", eventRouter);
|
router.use("/event", eventRouter);
|
||||||
|
router.get("/import", (req, res) => {
|
||||||
|
DATA.forEach((station) => {
|
||||||
|
prisma.station.create({
|
||||||
|
data: {
|
||||||
|
aircraftRegistration: "D-H",
|
||||||
|
aircraft: station.aircraft,
|
||||||
|
aircraftSpeed: station.aircraftSpeed,
|
||||||
|
atcCallsign: station.atcCallsign,
|
||||||
|
bosCallsign: station.bosCallsign,
|
||||||
|
bosCallsignShort: station.bosCallsignShort,
|
||||||
|
bosRadioArea: station.bosRadioArea,
|
||||||
|
fir: station.fir,
|
||||||
|
operator: station.operator,
|
||||||
|
bosUse: "PRIMARY",
|
||||||
|
country: station.country as Country,
|
||||||
|
hasNvg: station.hasNvg,
|
||||||
|
hasRope: station.hasRope,
|
||||||
|
hasWinch: station.hasWinch,
|
||||||
|
is24h: station.is24h,
|
||||||
|
hideRangeRings: station.hideRangeRings,
|
||||||
|
locationState: station.locationState,
|
||||||
|
locationStateShort: station.locationStateShort,
|
||||||
|
|
||||||
|
latitude: station.latitude,
|
||||||
|
longitude: station.longitude,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
export default router;
|
export default router;
|
||||||
|
|||||||
4478
apps/hub-server/routes/var.Station.json
Normal file
4478
apps/hub-server/routes/var.Station.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,28 +1,33 @@
|
|||||||
import { DatabaseBackupIcon } from "lucide-react";
|
import { DatabaseBackupIcon } from "lucide-react";
|
||||||
import { PaginatedTable } from "../../../_components/PaginatedTable";
|
import { PaginatedTable } from "../../../_components/PaginatedTable";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
|
import { ColumnDef } from "@tanstack/react-table";
|
||||||
|
import { Keyword } from "@repo/db";
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<PaginatedTable
|
<PaginatedTable
|
||||||
|
initialOrderBy={[{ id: "category", desc: true }]}
|
||||||
showEditButton
|
showEditButton
|
||||||
prismaModel="keyword"
|
prismaModel="keyword"
|
||||||
searchFields={["name", "abreviation", "description"]}
|
searchFields={["name", "abreviation", "description"]}
|
||||||
columns={[
|
columns={
|
||||||
{
|
[
|
||||||
header: "Kateogrie",
|
{
|
||||||
accessorKey: "category",
|
header: "Kateogrie",
|
||||||
},
|
accessorKey: "category",
|
||||||
{
|
},
|
||||||
header: "Name",
|
{
|
||||||
accessorKey: "name",
|
header: "Abkürzung",
|
||||||
},
|
accessorKey: "abreviation",
|
||||||
{
|
},
|
||||||
header: "Beschreibung",
|
{
|
||||||
accessorKey: "description",
|
header: "Name",
|
||||||
},
|
accessorKey: "name",
|
||||||
]}
|
},
|
||||||
|
] as ColumnDef<Keyword>[]
|
||||||
|
}
|
||||||
leftOfSearch={
|
leftOfSearch={
|
||||||
<span className="flex items-center gap-2">
|
<span className="flex items-center gap-2">
|
||||||
<DatabaseBackupIcon className="w-5 h-5" /> Stichwörter
|
<DatabaseBackupIcon className="w-5 h-5" /> Stichwörter
|
||||||
@@ -31,9 +36,7 @@ export default () => {
|
|||||||
rightOfSearch={
|
rightOfSearch={
|
||||||
<p className="text-2xl font-semibold text-left flex items-center gap-2 justify-between">
|
<p className="text-2xl font-semibold text-left flex items-center gap-2 justify-between">
|
||||||
<Link href={"/admin/keyword/new"}>
|
<Link href={"/admin/keyword/new"}>
|
||||||
<button className="btn btn-sm btn-outline btn-primary">
|
<button className="btn btn-sm btn-outline btn-primary">Erstellen</button>
|
||||||
Erstellen
|
|
||||||
</button>
|
|
||||||
</Link>
|
</Link>
|
||||||
</p>
|
</p>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export const StationForm = ({ station }: { station?: Station }) => {
|
|||||||
<form
|
<form
|
||||||
onSubmit={form.handleSubmit(async (values) => {
|
onSubmit={form.handleSubmit(async (values) => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const createdStation = await upsertStation(values, station?.id);
|
await upsertStation(values, station?.id);
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
if (!station) redirect(`/admin/station`);
|
if (!station) redirect(`/admin/station`);
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ enum Country {
|
|||||||
DE
|
DE
|
||||||
AT
|
AT
|
||||||
CH
|
CH
|
||||||
|
NL
|
||||||
|
LU
|
||||||
|
LI
|
||||||
}
|
}
|
||||||
|
|
||||||
model Station {
|
model Station {
|
||||||
|
|||||||
Reference in New Issue
Block a user