diff --git a/drizzle/0004_zippy_zarek.sql b/drizzle/0004_zippy_zarek.sql
new file mode 100644
index 0000000..7b08da9
--- /dev/null
+++ b/drizzle/0004_zippy_zarek.sql
@@ -0,0 +1,2 @@
+ALTER TABLE "airspace_static_element_groups" ADD COLUMN "created_at" timestamp DEFAULT now();--> statement-breakpoint
+ALTER TABLE "auth_user" ADD COLUMN "created_at" timestamp DEFAULT now();
\ No newline at end of file
diff --git a/drizzle/meta/0004_snapshot.json b/drizzle/meta/0004_snapshot.json
new file mode 100644
index 0000000..59fba74
--- /dev/null
+++ b/drizzle/meta/0004_snapshot.json
@@ -0,0 +1,733 @@
+{
+ "id": "78b4ec70-ab59-48e0-8cf9-c4d3d570b810",
+ "prevId": "628e428e-6047-438a-811c-09154021c1eb",
+ "version": "7",
+ "dialect": "postgresql",
+ "tables": {
+ "public.adar_records": {
+ "name": "adar_records",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "adar_id": {
+ "name": "adar_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "upper_altitude": {
+ "name": "upper_altitude",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "lower_altitude": {
+ "name": "lower_altitude",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "order": {
+ "name": "order",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "auto_route_limit": {
+ "name": "auto_route_limit",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "route_string": {
+ "name": "route_string",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "protected_area_overwrite": {
+ "name": "protected_area_overwrite",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "star_id": {
+ "name": "star_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "dp_id": {
+ "name": "dp_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "route_fixes": {
+ "name": "route_fixes",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "arrival_airports": {
+ "name": "arrival_airports",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "departure_airports": {
+ "name": "departure_airports",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_comment": {
+ "name": "user_comment",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "adar_records_adar_id_unique": {
+ "name": "adar_records_adar_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "adar_id"
+ ]
+ }
+ }
+ },
+ "public.aircraft": {
+ "name": "aircraft",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "code": {
+ "name": "code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "class": {
+ "name": "class",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "number_of_engines": {
+ "name": "number_of_engines",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "engine_type": {
+ "name": "engine_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "manufacturer": {
+ "name": "manufacturer",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "aircraft_code_index": {
+ "name": "aircraft_code_index",
+ "columns": [
+ {
+ "expression": "code",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.airlines": {
+ "name": "airlines",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company": {
+ "name": "company",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "country": {
+ "name": "country",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "telephony": {
+ "name": "telephony",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "code": {
+ "name": "code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "airline_code_index": {
+ "name": "airline_code_index",
+ "columns": [
+ {
+ "expression": "code",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.airspace_static_element_components": {
+ "name": "airspace_static_element_components",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "group_id": {
+ "name": "group_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "geojson": {
+ "name": "geojson",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "settings": {
+ "name": "settings",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "airspace_static_element_components_group_id_airspace_static_element_groups_id_fk": {
+ "name": "airspace_static_element_components_group_id_airspace_static_element_groups_id_fk",
+ "tableFrom": "airspace_static_element_components",
+ "tableTo": "airspace_static_element_groups",
+ "columnsFrom": [
+ "group_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.airspace_static_element_groups": {
+ "name": "airspace_static_element_groups",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "icon": {
+ "name": "icon",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_published": {
+ "name": "is_published",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.area_metadata": {
+ "name": "area_metadata",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "short": {
+ "name": "short",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "long": {
+ "name": "long",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "category": {
+ "name": "category",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tag": {
+ "name": "tag",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "geojson": {
+ "name": "geojson",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "frequency": {
+ "name": "frequency",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.auth_user": {
+ "name": "auth_user",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "first_name": {
+ "name": "first_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "last_name": {
+ "name": "last_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "is_admin": {
+ "name": "is_admin",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.restrictions": {
+ "name": "restrictions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "airport": {
+ "name": "airport",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "route": {
+ "name": "route",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "from": {
+ "name": "from",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "to": {
+ "name": "to",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "restriction": {
+ "name": "restriction",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "notes": {
+ "name": "notes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "priority": {
+ "name": "priority",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'0'"
+ },
+ "valid_at": {
+ "name": "valid_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ },
+ "valid_until": {
+ "name": "valid_until",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.split_group_areas": {
+ "name": "split_group_areas",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "group_id": {
+ "name": "group_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "area_id": {
+ "name": "area_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "split_group_areas_group_id_split_groups_id_fk": {
+ "name": "split_group_areas_group_id_split_groups_id_fk",
+ "tableFrom": "split_group_areas",
+ "tableTo": "split_groups",
+ "columnsFrom": [
+ "group_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "split_group_areas_area_id_area_metadata_id_fk": {
+ "name": "split_group_areas_area_id_area_metadata_id_fk",
+ "tableFrom": "split_group_areas",
+ "tableTo": "area_metadata",
+ "columnsFrom": [
+ "area_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.split_groups": {
+ "name": "split_groups",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "split_id": {
+ "name": "split_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "split_groups_split_id_splits_id_fk": {
+ "name": "split_groups_split_id_splits_id_fk",
+ "tableFrom": "split_groups",
+ "tableTo": "splits",
+ "columnsFrom": [
+ "split_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.splits": {
+ "name": "splits",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "is_published": {
+ "name": "is_published",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "is_default": {
+ "name": "is_default",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.user_session": {
+ "name": "user_session",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ }
+ },
+ "enums": {},
+ "schemas": {},
+ "_meta": {
+ "columns": {},
+ "schemas": {},
+ "tables": {}
+ }
+}
\ No newline at end of file
diff --git a/drizzle/meta/_journal.json b/drizzle/meta/_journal.json
index 716a675..5ceec70 100644
--- a/drizzle/meta/_journal.json
+++ b/drizzle/meta/_journal.json
@@ -29,6 +29,13 @@
"when": 1738544083149,
"tag": "0003_talented_darwin",
"breakpoints": true
+ },
+ {
+ "idx": 4,
+ "version": "7",
+ "when": 1738556826419,
+ "tag": "0004_zippy_zarek",
+ "breakpoints": true
}
]
}
\ No newline at end of file
diff --git a/src/lib/db/schema.ts b/src/lib/db/schema.ts
index c31d835..52cb234 100644
--- a/src/lib/db/schema.ts
+++ b/src/lib/db/schema.ts
@@ -69,7 +69,8 @@ export const authUserTable = pgTable('auth_user', {
cid: text('id').primaryKey(),
firstName: text('first_name').notNull(),
lastName: text('last_name').notNull(),
- isAdmin: boolean('is_admin').default(false).notNull()
+ isAdmin: boolean('is_admin').default(false).notNull(),
+ createdAt: timestamp('created_at').defaultNow()
});
export const userSessionTable = pgTable('user_session', {
@@ -88,7 +89,8 @@ export const airspaceStaticElementGroupsTable = pgTable('airspace_static_element
id: uuid('id').primaryKey().defaultRandom(),
name: text('name'),
icon: text('icon'),
- isPublished: boolean('is_published').notNull().default(false)
+ isPublished: boolean('is_published').notNull().default(false),
+ createdAt: timestamp('created_at').defaultNow()
});
export const airspaceStaticElementComponentsTable = pgTable('airspace_static_element_components', {
diff --git a/src/routes/(protected)/admin/airspace/+page.server.ts b/src/routes/(protected)/admin/airspace/+page.server.ts
index 97f55c7..e791342 100644
--- a/src/routes/(protected)/admin/airspace/+page.server.ts
+++ b/src/routes/(protected)/admin/airspace/+page.server.ts
@@ -59,7 +59,8 @@ export async function load() {
.leftJoin(
airspaceStaticElementComponentsTable,
eq(airspaceStaticElementGroupsTable.id, airspaceStaticElementComponentsTable.groupId)
- );
+ )
+ .orderBy(airspaceStaticElementGroupsTable.createdAt);
// Group results by static element groups and their components
const staticElements = Object.values(
diff --git a/src/routes/(protected)/admin/airspace/AddUpdateStaticElementForm.svelte b/src/routes/(protected)/admin/airspace/AddUpdateStaticElementForm.svelte
index 1119835..a78e3a2 100644
--- a/src/routes/(protected)/admin/airspace/AddUpdateStaticElementForm.svelte
+++ b/src/routes/(protected)/admin/airspace/AddUpdateStaticElementForm.svelte
@@ -27,7 +27,6 @@
let components: StaticElement[] = $state([]);
let activeElement: StaticElement | null = $state(null);
- let dropdownPosition = $state({ top: 0, left: 0 });
const { form, errors, constraints, message, enhance, reset } = superForm(data.form, {
dataType: 'json',
@@ -117,17 +116,10 @@
});
function toggleSettings(element: StaticElement, event: MouseEvent) {
- const button = event.currentTarget as HTMLElement;
- const rect = button.getBoundingClientRect();
-
if (activeElement === element) {
activeElement = null;
} else {
activeElement = element;
- dropdownPosition = {
- top: rect.bottom + window.scrollY + 8,
- left: rect.left + window.scrollX
- };
}
}
@@ -261,6 +253,106 @@