1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-08-02 19:55:18 +02:00

Merge pull request #30 from seanmorley15/development

Merge Development for Release v0.1.5-alpha
This commit is contained in:
Sean Morley 2024-04-13 19:11:50 -04:00 committed by GitHub
commit 8a2528e484
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
66 changed files with 1526 additions and 1680 deletions

View file

@ -4,6 +4,8 @@ FROM node:18-alpine AS external-website
# A small line inside the image to show who made it
LABEL Developers="Sean Morley"
RUN apk update && apk add postgresql-client
# The WORKDIR instruction sets the working directory for everything that will happen next
WORKDIR /app

View file

@ -1,6 +1,6 @@
services:
web:
image: ghcr.io/seanmorley15/adventurelog:latest
build: .
ports:
- "3000:3000"
environment:
@ -9,6 +9,8 @@ services:
- ORIGIN=http://localhost:3000
depends_on:
- db
volumes:
- ./sql:/sql
db:
image: postgres
environment:

View file

@ -1,5 +0,0 @@
CREATE TABLE IF NOT EXISTS "featuredAdventures" (
"id" serial PRIMARY KEY NOT NULL,
"name" text NOT NULL,
"location" text
);

View file

@ -0,0 +1,86 @@
CREATE TABLE IF NOT EXISTS "featuredAdventures" (
"id" serial PRIMARY KEY NOT NULL,
"name" text NOT NULL,
"location" text,
CONSTRAINT "featuredAdventures_name_unique" UNIQUE("name")
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "session" (
"id" text PRIMARY KEY NOT NULL,
"user_id" text NOT NULL,
"expires_at" timestamp with time zone NOT NULL
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "sharedAdventures" (
"id" text PRIMARY KEY NOT NULL,
"data" json NOT NULL,
"name" text NOT NULL,
"date" text NOT NULL
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "user" (
"id" text PRIMARY KEY NOT NULL,
"username" text NOT NULL,
"first_name" text NOT NULL,
"last_name" text NOT NULL,
"icon" text,
"hashed_password" varchar NOT NULL
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "userVisitedAdventures" (
"adventure_id" serial PRIMARY KEY NOT NULL,
"user_id" text NOT NULL,
"adventure_name" text NOT NULL,
"location" text,
"visited_date" text
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "userVisitedWorldTravel" (
"id" serial PRIMARY KEY NOT NULL,
"user_id" text NOT NULL,
"region_id" varchar NOT NULL
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "worldTravelCountries" (
"id" serial PRIMARY KEY NOT NULL,
"name" text NOT NULL,
"country_code" text NOT NULL,
"continent" text NOT NULL,
CONSTRAINT "worldTravelCountries_country_code_unique" UNIQUE("country_code")
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "worldTravelCountryRegions" (
"id" varchar PRIMARY KEY NOT NULL,
"name" text NOT NULL,
"country_code" text NOT NULL
);
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "session" ADD CONSTRAINT "session_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "user"("id") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "userVisitedAdventures" ADD CONSTRAINT "userVisitedAdventures_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "user"("id") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "userVisitedWorldTravel" ADD CONSTRAINT "userVisitedWorldTravel_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "user"("id") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "userVisitedWorldTravel" ADD CONSTRAINT "userVisitedWorldTravel_region_id_worldTravelCountryRegions_id_fk" FOREIGN KEY ("region_id") REFERENCES "worldTravelCountryRegions"("id") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "worldTravelCountryRegions" ADD CONSTRAINT "worldTravelCountryRegions_country_code_worldTravelCountries_country_code_fk" FOREIGN KEY ("country_code") REFERENCES "worldTravelCountries"("country_code") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;

View file

@ -1,6 +0,0 @@
CREATE TABLE IF NOT EXISTS "sharedAdventures" (
"id" serial PRIMARY KEY NOT NULL,
"name" text NOT NULL,
"location" text,
"date" text
);

View file

@ -1 +0,0 @@
ALTER TABLE "sharedAdventures" ALTER COLUMN "id" SET DATA TYPE text;

View file

@ -1,4 +0,0 @@
ALTER TABLE "sharedAdventures" ADD COLUMN "data" json NOT NULL;--> statement-breakpoint
ALTER TABLE "sharedAdventures" DROP COLUMN IF EXISTS "name";--> statement-breakpoint
ALTER TABLE "sharedAdventures" DROP COLUMN IF EXISTS "location";--> statement-breakpoint
ALTER TABLE "sharedAdventures" DROP COLUMN IF EXISTS "date";

View file

@ -1,15 +0,0 @@
CREATE TABLE IF NOT EXISTS "session" (
"id" text PRIMARY KEY NOT NULL,
"user_id" text NOT NULL,
"expires_at" timestamp with time zone NOT NULL
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "user" (
"id" text PRIMARY KEY NOT NULL
);
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "session" ADD CONSTRAINT "session_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "user"("id") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;

View file

@ -1,2 +0,0 @@
ALTER TABLE "user" ADD COLUMN "username" text NOT NULL;--> statement-breakpoint
ALTER TABLE "user" ADD COLUMN "hashed_password" text NOT NULL;

View file

@ -1 +0,0 @@
ALTER TABLE "user" ALTER COLUMN "hashed_password" SET DATA TYPE varchar;

View file

@ -1,2 +0,0 @@
ALTER TABLE "user" ADD COLUMN "first_name" text NOT NULL;--> statement-breakpoint
ALTER TABLE "user" ADD COLUMN "last_name" text NOT NULL;

View file

@ -1,12 +0,0 @@
CREATE TABLE IF NOT EXISTS "userVisitedAdventures" (
"user_id" text NOT NULL,
"adventure_name" text NOT NULL,
"location" text,
"adventure_visited" text
);
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "userVisitedAdventures" ADD CONSTRAINT "userVisitedAdventures_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "user"("id") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;

View file

@ -1,5 +0,0 @@
ALTER TABLE "userVisitedAdventures" RENAME COLUMN "adventure_visited" TO "adventure_id";--> statement-breakpoint
ALTER TABLE "userVisitedAdventures" ADD PRIMARY KEY ("adventure_id");--> statement-breakpoint
ALTER TABLE "userVisitedAdventures" ALTER COLUMN "adventure_id" SET DATA TYPE serial;--> statement-breakpoint
ALTER TABLE "userVisitedAdventures" ALTER COLUMN "adventure_id" SET NOT NULL;--> statement-breakpoint
ALTER TABLE "userVisitedAdventures" ADD COLUMN "visited_date" text;

View file

@ -1 +0,0 @@
ALTER TABLE "user" ADD COLUMN "icon" text;

View file

@ -1,5 +1,5 @@
{
"id": "1639b320-88dd-4af5-ae34-092ab26b4b85",
"id": "b6ab23b7-42f0-4475-aa5d-23b92c00e97f",
"prevId": "00000000-0000-0000-0000-000000000000",
"version": "5",
"dialect": "pg",
@ -30,6 +30,329 @@
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"featuredAdventures_name_unique": {
"name": "featuredAdventures_name_unique",
"nullsNotDistinct": false,
"columns": [
"name"
]
}
}
},
"session": {
"name": "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 with time zone",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {
"session_user_id_user_id_fk": {
"name": "session_user_id_user_id_fk",
"tableFrom": "session",
"tableTo": "user",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"sharedAdventures": {
"name": "sharedAdventures",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"data": {
"name": "data",
"type": "json",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"date": {
"name": "date",
"type": "text",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"user": {
"name": "user",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"username": {
"name": "username",
"type": "text",
"primaryKey": false,
"notNull": true
},
"first_name": {
"name": "first_name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"last_name": {
"name": "last_name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"icon": {
"name": "icon",
"type": "text",
"primaryKey": false,
"notNull": false
},
"hashed_password": {
"name": "hashed_password",
"type": "varchar",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"userVisitedAdventures": {
"name": "userVisitedAdventures",
"schema": "",
"columns": {
"adventure_id": {
"name": "adventure_id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"adventure_name": {
"name": "adventure_name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"location": {
"name": "location",
"type": "text",
"primaryKey": false,
"notNull": false
},
"visited_date": {
"name": "visited_date",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"userVisitedAdventures_user_id_user_id_fk": {
"name": "userVisitedAdventures_user_id_user_id_fk",
"tableFrom": "userVisitedAdventures",
"tableTo": "user",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"userVisitedWorldTravel": {
"name": "userVisitedWorldTravel",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"region_id": {
"name": "region_id",
"type": "varchar",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {
"userVisitedWorldTravel_user_id_user_id_fk": {
"name": "userVisitedWorldTravel_user_id_user_id_fk",
"tableFrom": "userVisitedWorldTravel",
"tableTo": "user",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"userVisitedWorldTravel_region_id_worldTravelCountryRegions_id_fk": {
"name": "userVisitedWorldTravel_region_id_worldTravelCountryRegions_id_fk",
"tableFrom": "userVisitedWorldTravel",
"tableTo": "worldTravelCountryRegions",
"columnsFrom": [
"region_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"worldTravelCountries": {
"name": "worldTravelCountries",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"country_code": {
"name": "country_code",
"type": "text",
"primaryKey": false,
"notNull": true
},
"continent": {
"name": "continent",
"type": "text",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"worldTravelCountries_country_code_unique": {
"name": "worldTravelCountries_country_code_unique",
"nullsNotDistinct": false,
"columns": [
"country_code"
]
}
}
},
"worldTravelCountryRegions": {
"name": "worldTravelCountryRegions",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "varchar",
"primaryKey": true,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"country_code": {
"name": "country_code",
"type": "text",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {
"worldTravelCountryRegions_country_code_worldTravelCountries_country_code_fk": {
"name": "worldTravelCountryRegions_country_code_worldTravelCountries_country_code_fk",
"tableFrom": "worldTravelCountryRegions",
"tableTo": "worldTravelCountries",
"columnsFrom": [
"country_code"
],
"columnsTo": [
"country_code"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
}
},

View file

@ -1,77 +0,0 @@
{
"id": "183ebfda-8d83-4256-8715-169d36867deb",
"prevId": "1639b320-88dd-4af5-ae34-092ab26b4b85",
"version": "5",
"dialect": "pg",
"tables": {
"featuredAdventures": {
"name": "featuredAdventures",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"location": {
"name": "location",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"sharedAdventures": {
"name": "sharedAdventures",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"location": {
"name": "location",
"type": "text",
"primaryKey": false,
"notNull": false
},
"date": {
"name": "date",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
}
},
"enums": {},
"schemas": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {}
}
}

View file

@ -1,77 +0,0 @@
{
"id": "808d6d31-5ef6-4b22-97f0-cfc73193eb5e",
"prevId": "183ebfda-8d83-4256-8715-169d36867deb",
"version": "5",
"dialect": "pg",
"tables": {
"featuredAdventures": {
"name": "featuredAdventures",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"location": {
"name": "location",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"sharedAdventures": {
"name": "sharedAdventures",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"location": {
"name": "location",
"type": "text",
"primaryKey": false,
"notNull": false
},
"date": {
"name": "date",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
}
},
"enums": {},
"schemas": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {}
}
}

View file

@ -1,65 +0,0 @@
{
"id": "45d98527-f0a9-44fc-9658-d3c461afed95",
"prevId": "808d6d31-5ef6-4b22-97f0-cfc73193eb5e",
"version": "5",
"dialect": "pg",
"tables": {
"featuredAdventures": {
"name": "featuredAdventures",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"location": {
"name": "location",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"sharedAdventures": {
"name": "sharedAdventures",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"data": {
"name": "data",
"type": "json",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
}
},
"enums": {},
"schemas": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {}
}
}

View file

@ -1,123 +0,0 @@
{
"id": "ccf7c336-c61f-452f-822b-b3b039bb20f9",
"prevId": "45d98527-f0a9-44fc-9658-d3c461afed95",
"version": "5",
"dialect": "pg",
"tables": {
"featuredAdventures": {
"name": "featuredAdventures",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"location": {
"name": "location",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"session": {
"name": "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 with time zone",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {
"session_user_id_user_id_fk": {
"name": "session_user_id_user_id_fk",
"tableFrom": "session",
"tableTo": "user",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"sharedAdventures": {
"name": "sharedAdventures",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"data": {
"name": "data",
"type": "json",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"user": {
"name": "user",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
}
},
"enums": {},
"schemas": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {}
}
}

View file

@ -1,135 +0,0 @@
{
"id": "e91dda33-e04e-4e99-a297-21a34aa35493",
"prevId": "ccf7c336-c61f-452f-822b-b3b039bb20f9",
"version": "5",
"dialect": "pg",
"tables": {
"featuredAdventures": {
"name": "featuredAdventures",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"location": {
"name": "location",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"session": {
"name": "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 with time zone",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {
"session_user_id_user_id_fk": {
"name": "session_user_id_user_id_fk",
"tableFrom": "session",
"tableTo": "user",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"sharedAdventures": {
"name": "sharedAdventures",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"data": {
"name": "data",
"type": "json",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"user": {
"name": "user",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"username": {
"name": "username",
"type": "text",
"primaryKey": false,
"notNull": true
},
"hashed_password": {
"name": "hashed_password",
"type": "text",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
}
},
"enums": {},
"schemas": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {}
}
}

View file

@ -1,135 +0,0 @@
{
"id": "b0849b3e-02e1-42e1-b07c-6fa613c98e82",
"prevId": "e91dda33-e04e-4e99-a297-21a34aa35493",
"version": "5",
"dialect": "pg",
"tables": {
"featuredAdventures": {
"name": "featuredAdventures",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"location": {
"name": "location",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"session": {
"name": "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 with time zone",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {
"session_user_id_user_id_fk": {
"name": "session_user_id_user_id_fk",
"tableFrom": "session",
"tableTo": "user",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"sharedAdventures": {
"name": "sharedAdventures",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"data": {
"name": "data",
"type": "json",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"user": {
"name": "user",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"username": {
"name": "username",
"type": "text",
"primaryKey": false,
"notNull": true
},
"hashed_password": {
"name": "hashed_password",
"type": "varchar",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
}
},
"enums": {},
"schemas": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {}
}
}

View file

@ -1,147 +0,0 @@
{
"id": "2039600b-1f5f-4f37-84dd-bb40636855e7",
"prevId": "b0849b3e-02e1-42e1-b07c-6fa613c98e82",
"version": "5",
"dialect": "pg",
"tables": {
"featuredAdventures": {
"name": "featuredAdventures",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"location": {
"name": "location",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"session": {
"name": "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 with time zone",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {
"session_user_id_user_id_fk": {
"name": "session_user_id_user_id_fk",
"tableFrom": "session",
"tableTo": "user",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"sharedAdventures": {
"name": "sharedAdventures",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"data": {
"name": "data",
"type": "json",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"user": {
"name": "user",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"username": {
"name": "username",
"type": "text",
"primaryKey": false,
"notNull": true
},
"first_name": {
"name": "first_name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"last_name": {
"name": "last_name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"hashed_password": {
"name": "hashed_password",
"type": "varchar",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
}
},
"enums": {},
"schemas": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {}
}
}

View file

@ -1,195 +0,0 @@
{
"id": "ec5af5e4-8522-4383-af47-412fb43c7cc3",
"prevId": "2039600b-1f5f-4f37-84dd-bb40636855e7",
"version": "5",
"dialect": "pg",
"tables": {
"featuredAdventures": {
"name": "featuredAdventures",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"location": {
"name": "location",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"session": {
"name": "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 with time zone",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {
"session_user_id_user_id_fk": {
"name": "session_user_id_user_id_fk",
"tableFrom": "session",
"tableTo": "user",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"sharedAdventures": {
"name": "sharedAdventures",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"data": {
"name": "data",
"type": "json",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"user": {
"name": "user",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"username": {
"name": "username",
"type": "text",
"primaryKey": false,
"notNull": true
},
"first_name": {
"name": "first_name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"last_name": {
"name": "last_name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"hashed_password": {
"name": "hashed_password",
"type": "varchar",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"userVisitedAdventures": {
"name": "userVisitedAdventures",
"schema": "",
"columns": {
"user_id": {
"name": "user_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"adventure_name": {
"name": "adventure_name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"location": {
"name": "location",
"type": "text",
"primaryKey": false,
"notNull": false
},
"adventure_visited": {
"name": "adventure_visited",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"userVisitedAdventures_user_id_user_id_fk": {
"name": "userVisitedAdventures_user_id_user_id_fk",
"tableFrom": "userVisitedAdventures",
"tableTo": "user",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
}
},
"enums": {},
"schemas": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {}
}
}

View file

@ -1,201 +0,0 @@
{
"id": "1d83805d-6ee2-4dae-87a6-5af6f2d5add3",
"prevId": "ec5af5e4-8522-4383-af47-412fb43c7cc3",
"version": "5",
"dialect": "pg",
"tables": {
"featuredAdventures": {
"name": "featuredAdventures",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"location": {
"name": "location",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"session": {
"name": "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 with time zone",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {
"session_user_id_user_id_fk": {
"name": "session_user_id_user_id_fk",
"tableFrom": "session",
"tableTo": "user",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"sharedAdventures": {
"name": "sharedAdventures",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"data": {
"name": "data",
"type": "json",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"user": {
"name": "user",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"username": {
"name": "username",
"type": "text",
"primaryKey": false,
"notNull": true
},
"first_name": {
"name": "first_name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"last_name": {
"name": "last_name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"hashed_password": {
"name": "hashed_password",
"type": "varchar",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"userVisitedAdventures": {
"name": "userVisitedAdventures",
"schema": "",
"columns": {
"adventure_id": {
"name": "adventure_id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"adventure_name": {
"name": "adventure_name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"location": {
"name": "location",
"type": "text",
"primaryKey": false,
"notNull": false
},
"visited_date": {
"name": "visited_date",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"userVisitedAdventures_user_id_user_id_fk": {
"name": "userVisitedAdventures_user_id_user_id_fk",
"tableFrom": "userVisitedAdventures",
"tableTo": "user",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
}
},
"enums": {},
"schemas": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {}
}
}

View file

@ -1,207 +0,0 @@
{
"id": "d6cd08c8-9dc8-42df-aab9-0f5800602864",
"prevId": "1d83805d-6ee2-4dae-87a6-5af6f2d5add3",
"version": "5",
"dialect": "pg",
"tables": {
"featuredAdventures": {
"name": "featuredAdventures",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"location": {
"name": "location",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"session": {
"name": "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 with time zone",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {
"session_user_id_user_id_fk": {
"name": "session_user_id_user_id_fk",
"tableFrom": "session",
"tableTo": "user",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"sharedAdventures": {
"name": "sharedAdventures",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"data": {
"name": "data",
"type": "json",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"user": {
"name": "user",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"username": {
"name": "username",
"type": "text",
"primaryKey": false,
"notNull": true
},
"first_name": {
"name": "first_name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"last_name": {
"name": "last_name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"icon": {
"name": "icon",
"type": "text",
"primaryKey": false,
"notNull": false
},
"hashed_password": {
"name": "hashed_password",
"type": "varchar",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"userVisitedAdventures": {
"name": "userVisitedAdventures",
"schema": "",
"columns": {
"adventure_id": {
"name": "adventure_id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"adventure_name": {
"name": "adventure_name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"location": {
"name": "location",
"type": "text",
"primaryKey": false,
"notNull": false
},
"visited_date": {
"name": "visited_date",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"userVisitedAdventures_user_id_user_id_fk": {
"name": "userVisitedAdventures_user_id_user_id_fk",
"tableFrom": "userVisitedAdventures",
"tableTo": "user",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
}
},
"enums": {},
"schemas": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {}
}
}

View file

@ -5,78 +5,8 @@
{
"idx": 0,
"version": "5",
"when": 1712061709595,
"tag": "0000_fancy_starjammers",
"breakpoints": true
},
{
"idx": 1,
"version": "5",
"when": 1712083579596,
"tag": "0001_nostalgic_skreet",
"breakpoints": true
},
{
"idx": 2,
"version": "5",
"when": 1712083756923,
"tag": "0002_dusty_captain_midlands",
"breakpoints": true
},
{
"idx": 3,
"version": "5",
"when": 1712083977580,
"tag": "0003_clammy_goblin_queen",
"breakpoints": true
},
{
"idx": 4,
"version": "5",
"when": 1712103855532,
"tag": "0004_smart_maelstrom",
"breakpoints": true
},
{
"idx": 5,
"version": "5",
"when": 1712104331399,
"tag": "0005_glamorous_pixie",
"breakpoints": true
},
{
"idx": 6,
"version": "5",
"when": 1712105206127,
"tag": "0006_melted_leech",
"breakpoints": true
},
{
"idx": 7,
"version": "5",
"when": 1712167204757,
"tag": "0007_nervous_scalphunter",
"breakpoints": true
},
{
"idx": 8,
"version": "5",
"when": 1712186591227,
"tag": "0008_romantic_maria_hill",
"breakpoints": true
},
{
"idx": 9,
"version": "5",
"when": 1712407140727,
"tag": "0009_spotty_madame_web",
"breakpoints": true
},
{
"idx": 10,
"version": "5",
"when": 1712842196443,
"tag": "0010_lean_gamma_corps",
"when": 1713037717607,
"tag": "0000_hard_mach_iv",
"breakpoints": true
}
]

View file

@ -1,81 +0,0 @@
INSERT INTO "featuredAdventures" (id, name, location) VALUES
(20, 'Yellowstone National Park', 'Wyoming, Montana, Idaho, USA'),
(21, 'Yosemite National Park', 'California, USA'),
(22, 'Banff National Park', 'Alberta, Canada'),
(23, 'Kruger National Park', 'Limpopo, South Africa'),
(24, 'Grand Canyon National Park', 'Arizona, USA'),
(25, 'Great Smoky Mountains National Park', 'North Carolina, Tennessee, USA'),
(26, 'Zion National Park', 'Utah, USA'),
(27, 'Glacier National Park', 'Montana, USA'),
(28, 'Rocky Mountain National Park', 'Colorado, USA'),
(29, 'Everglades National Park', 'Florida, USA'),
(30, 'Arches National Park', 'Utah, USA'),
(31, 'Acadia National Park', 'Maine, USA'),
(32, 'Sequoia National Park', 'California, USA'),
(33, 'Joshua Tree National Park', 'California, USA'),
(34, 'Yellowstone National Park', 'Wyoming, Montana, Idaho, USA'),
(35, 'Bryce Canyon National Park', 'Utah, USA'),
(36, 'Grand Teton National Park', 'Wyoming, USA'),
(37, 'Denali National Park', 'Alaska, USA'),
(38, 'Olympic National Park', 'Washington, USA'),
(39, 'Canyonlands National Park', 'Utah, USA'),
(40, 'Death Valley National Park', 'California, Nevada, USA'),
(41, 'Redwood National and State Parks', 'California, USA'),
(42, 'Waterton Lakes National Park', 'Alberta, Canada'),
(43, 'Mesa Verde National Park', 'Colorado, USA'),
(44, 'Petrified Forest National Park', 'Arizona, USA'),
(45, 'Capitol Reef National Park', 'Utah, USA'),
(46, 'Yellowstone National Park', 'Wyoming, Montana, Idaho, USA'),
(47, 'Yosemite National Park', 'California, USA'),
(48, 'Banff National Park', 'Alberta, Canada'),
(49, 'Kruger National Park', 'Limpopo, South Africa'),
(50, 'Grand Canyon National Park', 'Arizona, USA'),
(51, 'Great Smoky Mountains National Park', 'North Carolina, Tennessee, USA'),
(52, 'Zion National Park', 'Utah, USA'),
(53, 'Glacier National Park', 'Montana, USA'),
(54, 'Rocky Mountain National Park', 'Colorado, USA'),
(55, 'Everglades National Park', 'Florida, USA'),
(56, 'Arches National Park', 'Utah, USA'),
(57, 'Acadia National Park', 'Maine, USA'),
(58, 'Sequoia National Park', 'California, USA'),
(59, 'Joshua Tree National Park', 'California, USA'),
(60, 'Yellowstone National Park', 'Wyoming, Montana, Idaho, USA'),
(61, 'Bryce Canyon National Park', 'Utah, USA'),
(62, 'Grand Teton National Park', 'Wyoming, USA'),
(63, 'Denali National Park', 'Alaska, USA'),
(64, 'Olympic National Park', 'Washington, USA'),
(65, 'Canyonlands National Park', 'Utah, USA'),
(66, 'Yellowstone National Park', 'Wyoming, Montana, Idaho, USA'),
(67, 'Yosemite National Park', 'California, USA'),
(68, 'Banff National Park', 'Alberta, Canada'),
(69, 'Kruger National Park', 'Limpopo, South Africa'),
(70, 'Grand Canyon National Park', 'Arizona, USA'),
(71, 'Great Smoky Mountains National Park', 'North Carolina, Tennessee, USA'),
(72, 'Zion National Park', 'Utah, USA'),
(73, 'Glacier National Park', 'Montana, USA'),
(74, 'Rocky Mountain National Park', 'Colorado, USA'),
(75, 'Everglades National Park', 'Florida, USA'),
(76, 'Arches National Park', 'Utah, USA'),
(77, 'Acadia National Park', 'Maine, USA'),
(78, 'Sequoia National Park', 'California, USA'),
(79, 'Joshua Tree National Park', 'California, USA'),
(80, 'Yellowstone National Park', 'Wyoming, Montana, Idaho, USA'),
(81, 'Bryce Canyon National Park', 'Utah, USA'),
(82, 'Grand Teton National Park', 'Wyoming, USA'),
(83, 'Denali National Park', 'Alaska, USA'),
(84, 'Olympic National Park', 'Washington, USA'),
(85, 'Canyonlands National Park', 'Utah, USA'),
(86, 'Yellowstone National Park', 'Wyoming, Montana, Idaho, USA'),
(87, 'Yosemite National Park', 'California, USA'),
(88, 'Banff National Park', 'Alberta, Canada'),
(89, 'Kruger National Park', 'Limpopo, South Africa'),
(90, 'Grand Canyon National Park', 'Arizona, USA'),
(91, 'Great Smoky Mountains National Park', 'North Carolina, Tennessee, USA'),
(92, 'Zion National Park', 'Utah, USA'),
(93, 'Glacier National Park', 'Montana, USA'),
(94, 'Rocky Mountain National Park', 'Colorado, USA'),
(95, 'Everglades National Park', 'Florida, USA'),
(96, 'Arches National Park', 'Utah, USA'),
(97, 'Acadia National Park', 'Maine, USA'),
(98, 'Sequoia National Park', 'California, USA'),
(99, 'Joshua Tree National Park', 'California, USA');

18
sql/001_countries.sql Normal file
View file

@ -0,0 +1,18 @@
INSERT INTO "worldTravelCountries" (name, country_code, continent)
VALUES
('United States', 'us', 'North America'),
('Canada', 'ca', 'North America'),
('Mexico', 'mx', 'North America'),
('Brazil', 'br', 'South America'),
('Argentina', 'ar', 'South America'),
('United Kingdom', 'gb', 'Europe'),
('Germany', 'de', 'Europe'),
('France', 'fr', 'Europe'),
('Japan', 'jp', 'Asia'),
('China', 'cn', 'Asia'),
('India', 'in', 'Asia'),
('Australia', 'au', 'Oceania'),
('New Zealand', 'nz', 'Oceania'),
('South Africa', 'za', 'Africa'),
('Egypt', 'eg', 'Africa')
ON CONFLICT (country_code) DO NOTHING;

53
sql/002_us.sql Normal file
View file

@ -0,0 +1,53 @@
INSERT INTO "worldTravelCountryRegions" (id, name, country_code)
VALUES
('US-AL', 'Alabama', 'us'),
('US-AK', 'Alaska', 'us'),
('US-AZ', 'Arizona', 'us'),
('US-AR', 'Arkansas', 'us'),
('US-CA', 'California', 'us'),
('US-CO', 'Colorado', 'us'),
('US-CT', 'Connecticut', 'us'),
('US-DE', 'Delaware', 'us'),
('US-FL', 'Florida', 'us'),
('US-GA', 'Georgia', 'us'),
('US-HI', 'Hawaii', 'us'),
('US-ID', 'Idaho', 'us'),
('US-IL', 'Illinois', 'us'),
('US-IN', 'Indiana', 'us'),
('US-IA', 'Iowa', 'us'),
('US-KS', 'Kansas', 'us'),
('US-KY', 'Kentucky', 'us'),
('US-LA', 'Louisiana', 'us'),
('US-ME', 'Maine', 'us'),
('US-MD', 'Maryland', 'us'),
('US-MA', 'Massachusetts', 'us'),
('US-MI', 'Michigan', 'us'),
('US-MN', 'Minnesota', 'us'),
('US-MS', 'Mississippi', 'us'),
('US-MO', 'Missouri', 'us'),
('US-MT', 'Montana', 'us'),
('US-NE', 'Nebraska', 'us'),
('US-NV', 'Nevada', 'us'),
('US-NH', 'New Hampshire', 'us'),
('US-NJ', 'New Jersey', 'us'),
('US-NM', 'New Mexico', 'us'),
('US-NY', 'New York', 'us'),
('US-NC', 'North Carolina', 'us'),
('US-ND', 'North Dakota', 'us'),
('US-OH', 'Ohio', 'us'),
('US-OK', 'Oklahoma', 'us'),
('US-OR', 'Oregon', 'us'),
('US-PA', 'Pennsylvania', 'us'),
('US-RI', 'Rhode Island', 'us'),
('US-SC', 'South Carolina', 'us'),
('US-SD', 'South Dakota', 'us'),
('US-TN', 'Tennessee', 'us'),
('US-TX', 'Texas', 'us'),
('US-UT', 'Utah', 'us'),
('US-VT', 'Vermont', 'us'),
('US-VA', 'Virginia', 'us'),
('US-WA', 'Washington', 'us'),
('US-WV', 'West Virginia', 'us'),
('US-WI', 'Wisconsin', 'us'),
('US-WY', 'Wyoming', 'us')
ON CONFLICT (id) DO NOTHING;

16
sql/003_ca.sql Normal file
View file

@ -0,0 +1,16 @@
INSERT INTO "worldTravelCountryRegions" (id, name, country_code)
VALUES
('CA-AB', 'Alberta', 'ca'),
('CA-BC', 'British Columbia', 'ca'),
('CA-MB', 'Manitoba', 'ca'),
('CA-NB', 'New Brunswick', 'ca'),
('CA-NL', 'Newfoundland and Labrador', 'ca'),
('CA-NS', 'Nova Scotia', 'ca'),
('CA-ON', 'Ontario', 'ca'),
('CA-PE', 'Prince Edward Island', 'ca'),
('CA-QC', 'Quebec', 'ca'),
('CA-SK', 'Saskatchewan', 'ca'),
('CA-NT', 'Northwest Territories', 'ca'),
('CA-NU', 'Nunavut', 'ca'),
('CA-YT', 'Yukon', 'ca')
ON CONFLICT (id) DO NOTHING;

20
sql/004_de.sql Normal file
View file

@ -0,0 +1,20 @@
INSERT INTO "worldTravelCountryRegions" (id, name, country_code)
VALUES
('DE-BW', 'Baden-Württemberg', 'de'),
('DE-BY', 'Bavaria', 'de'),
('DE-BE', 'Berlin', 'de'),
('DE-BB', 'Brandenburg', 'de'),
('DE-HB', 'Bremen', 'de'),
('DE-HH', 'Hamburg', 'de'),
('DE-HE', 'Hesse', 'de'),
('DE-NI', 'Lower Saxony', 'de'),
('DE-MV', 'Mecklenburg-Vorpommern', 'de'),
('DE-NW', 'North Rhine-Westphalia', 'de'),
('DE-RP', 'Rhineland-Palatinate', 'de'),
('DE-SL', 'Saarland', 'de'),
('DE-SN', 'Saxony', 'de'),
('DE-ST', 'Saxony-Anhalt', 'de'),
('DE-SH', 'Schleswig-Holstein', 'de'),
('DE-TH', 'Thuringia', 'de')
ON CONFLICT (id) DO NOTHING;

22
sql/005_fr.sql Normal file
View file

@ -0,0 +1,22 @@
INSERT INTO "worldTravelCountryRegions" (id, name, country_code)
VALUES
('FR-ARA', 'Auvergne-Rhône-Alpes', 'fr'),
('FR-BFC', 'Bourgogne-Franche-Comté', 'fr'),
('FR-BRE', 'Brittany', 'fr'),
('FR-CVL', 'Centre-Val de Loire', 'fr'),
('FR-GES', 'Grand Est', 'fr'),
('FR-HDF', 'Hauts-de-France', 'fr'),
('FR-IDF', 'Île-de-France', 'fr'),
('FR-NOR', 'Normandy', 'fr'),
('FR-NAQ', 'Nouvelle-Aquitaine', 'fr'),
('FR-OCC', 'Occitanie', 'fr'),
('FR-PDL', 'Pays de la Loire', 'fr'),
('FR-PAC', 'Provence-Alpes-Côte d''Azur', 'fr'),
('FR-COR', 'Corsica', 'fr'),
('FR-MQ', 'Martinique', 'fr'),
('FR-GF', 'French Guiana', 'fr'),
('FR-RÉ', 'Réunion', 'fr'),
('FR-YT', 'Mayotte', 'fr'),
('FR-GP', 'Guadeloupe', 'fr')
ON CONFLICT (id) DO NOTHING;

8
sql/006_gb.sql Normal file
View file

@ -0,0 +1,8 @@
INSERT INTO "worldTravelCountryRegions" (id, name, country_code)
VALUES
('GB-ENG', 'England', 'gb'),
('GB-NIR', 'Northern Ireland', 'gb'),
('GB-SCT', 'Scotland', 'gb'),
('GB-WLS', 'Wales', 'gb')
ON CONFLICT (id) DO NOTHING;

28
sql/007_ar.sql Normal file
View file

@ -0,0 +1,28 @@
INSERT INTO "worldTravelCountryRegions" (id, name, country_code)
VALUES
('AR-C', 'Ciudad Autónoma de Buenos Aires', 'ar'),
('AR-B', 'Buenos Aires', 'ar'),
('AR-K', 'Catamarca', 'ar'),
('AR-H', 'Chaco', 'ar'),
('AR-U', 'Chubut', 'ar'),
('AR-W', 'Córdoba', 'ar'),
('AR-X', 'Corrientes', 'ar'),
('AR-E', 'Entre Ríos', 'ar'),
('AR-P', 'Formosa', 'ar'),
('AR-Y', 'Jujuy', 'ar'),
('AR-L', 'La Pampa', 'ar'),
('AR-F', 'La Rioja', 'ar'),
('AR-M', 'Mendoza', 'ar'),
('AR-N', 'Misiones', 'ar'),
('AR-Q', 'Neuquén', 'ar'),
('AR-R', 'Río Negro', 'ar'),
('AR-A', 'Salta', 'ar'),
('AR-J', 'San Juan', 'ar'),
('AR-D', 'San Luis', 'ar'),
('AR-Z', 'Santa Cruz', 'ar'),
('AR-S', 'Santa Fe', 'ar'),
('AR-G', 'Santiago del Estero', 'ar'),
('AR-V', 'Tierra del Fuego', 'ar'),
('AR-T', 'Tucumán', 'ar')
ON CONFLICT (id) DO NOTHING;

35
sql/008_mx.sql Normal file
View file

@ -0,0 +1,35 @@
INSERT INTO "worldTravelCountryRegions" (id, name, country_code)
VALUES
('MX-AGU', 'Aguascalientes', 'mx'),
('MX-BCN', 'Baja California', 'mx'),
('MX-BCS', 'Baja California Sur', 'mx'),
('MX-CAM', 'Campeche', 'mx'),
('MX-CHP', 'Chiapas', 'mx'),
('MX-CHH', 'Chihuahua', 'mx'),
('MX-COA', 'Coahuila', 'mx'),
('MX-COL', 'Colima', 'mx'),
('MX-DUR', 'Durango', 'mx'),
('MX-GUA', 'Guanajuato', 'mx'),
('MX-GRO', 'Guerrero', 'mx'),
('MX-HID', 'Hidalgo', 'mx'),
('MX-JAL', 'Jalisco', 'mx'),
('MX-MEX', 'State of Mexico', 'mx'),
('MX-MIC', 'Michoacán', 'mx'),
('MX-MOR', 'Morelos', 'mx'),
('MX-NAY', 'Nayarit', 'mx'),
('MX-NLE', 'Nuevo León', 'mx'),
('MX-OAX', 'Oaxaca', 'mx'),
('MX-PUE', 'Puebla', 'mx'),
('MX-QUE', 'Querétaro', 'mx'),
('MX-ROO', 'Quintana Roo', 'mx'),
('MX-SLP', 'San Luis Potosí', 'mx'),
('MX-SIN', 'Sinaloa', 'mx'),
('MX-SON', 'Sonora', 'mx'),
('MX-TAB', 'Tabasco', 'mx'),
('MX-TAM', 'Tamaulipas', 'mx'),
('MX-TLA', 'Tlaxcala', 'mx'),
('MX-VER', 'Veracruz', 'mx'),
('MX-YUC', 'Yucatán', 'mx'),
('MX-ZAC', 'Zacatecas', 'mx')
ON CONFLICT (id) DO NOTHING;

51
sql/009_jp.sql Normal file
View file

@ -0,0 +1,51 @@
INSERT INTO "worldTravelCountryRegions" (id, name, country_code)
VALUES
('JP-01', 'Hokkaido', 'jp'),
('JP-02', 'Aomori', 'jp'),
('JP-03', 'Iwate', 'jp'),
('JP-04', 'Miyagi', 'jp'),
('JP-05', 'Akita', 'jp'),
('JP-06', 'Yamagata', 'jp'),
('JP-07', 'Fukushima', 'jp'),
('JP-08', 'Ibaraki', 'jp'),
('JP-09', 'Tochigi', 'jp'),
('JP-10', 'Gunma', 'jp'),
('JP-11', 'Saitama', 'jp'),
('JP-12', 'Chiba', 'jp'),
('JP-13', 'Tokyo', 'jp'),
('JP-14', 'Kanagawa', 'jp'),
('JP-15', 'Niigata', 'jp'),
('JP-16', 'Toyama', 'jp'),
('JP-17', 'Ishikawa', 'jp'),
('JP-18', 'Fukui', 'jp'),
('JP-19', 'Yamanashi', 'jp'),
('JP-20', 'Nagano', 'jp'),
('JP-21', 'Gifu', 'jp'),
('JP-22', 'Shizuoka', 'jp'),
('JP-23', 'Aichi', 'jp'),
('JP-24', 'Mie', 'jp'),
('JP-25', 'Shiga', 'jp'),
('JP-26', 'Kyoto', 'jp'),
('JP-27', 'Osaka', 'jp'),
('JP-28', 'Hyogo', 'jp'),
('JP-29', 'Nara', 'jp'),
('JP-30', 'Wakayama', 'jp'),
('JP-31', 'Tottori', 'jp'),
('JP-32', 'Shimane', 'jp'),
('JP-33', 'Okayama', 'jp'),
('JP-34', 'Hiroshima', 'jp'),
('JP-35', 'Yamaguchi', 'jp'),
('JP-36', 'Tokushima', 'jp'),
('JP-37', 'Kagawa', 'jp'),
('JP-38', 'Ehime', 'jp'),
('JP-39', 'Kochi', 'jp'),
('JP-40', 'Fukuoka', 'jp'),
('JP-41', 'Saga', 'jp'),
('JP-42', 'Nagasaki', 'jp'),
('JP-43', 'Kumamoto', 'jp'),
('JP-44', 'Oita', 'jp'),
('JP-45', 'Miyazaki', 'jp'),
('JP-46', 'Kagoshima', 'jp'),
('JP-47', 'Okinawa', 'jp')
ON CONFLICT (id) DO NOTHING;

35
sql/010_cn.sql Normal file
View file

@ -0,0 +1,35 @@
INSERT INTO "worldTravelCountryRegions" (id, name, country_code)
VALUES
('CN-BJ', 'Beijing', 'cn'),
('CN-TJ', 'Tianjin', 'cn'),
('CN-HE', 'Hebei', 'cn'),
('CN-SX', 'Shanxi', 'cn'),
('CN-NM', 'Inner Mongolia', 'cn'),
('CN-LN', 'Liaoning', 'cn'),
('CN-JL', 'Jilin', 'cn'),
('CN-HL', 'Heilongjiang', 'cn'),
('CN-SH', 'Shanghai', 'cn'),
('CN-JS', 'Jiangsu', 'cn'),
('CN-ZJ', 'Zhejiang', 'cn'),
('CN-AH', 'Anhui', 'cn'),
('CN-FJ', 'Fujian', 'cn'),
('CN-JX', 'Jiangxi', 'cn'),
('CN-SD', 'Shandong', 'cn'),
('CN-HA', 'Henan', 'cn'),
('CN-HB', 'Hubei', 'cn'),
('CN-HN', 'Hunan', 'cn'),
('CN-GD', 'Guangdong', 'cn'),
('CN-GX', 'Guangxi', 'cn'),
('CN-HI', 'Hainan', 'cn'),
('CN-CQ', 'Chongqing', 'cn'),
('CN-SC', 'Sichuan', 'cn'),
('CN-GZ', 'Guizhou', 'cn'),
('CN-YN', 'Yunnan', 'cn'),
('CN-XZ', 'Tibet', 'cn'),
('CN-SA', 'Shaanxi', 'cn'),
('CN-GS', 'Gansu', 'cn'),
('CN-QH', 'Qinghai', 'cn'),
('CN-NX', 'Ningxia', 'cn'),
('CN-XJ', 'Xinjiang', 'cn')
ON CONFLICT (id) DO NOTHING;

39
sql/011_in.sql Normal file
View file

@ -0,0 +1,39 @@
INSERT INTO "worldTravelCountryRegions" (id, name, country_code)
VALUES
('IN-AN', 'Andaman and Nicobar Islands', 'in'),
('IN-AP', 'Andhra Pradesh', 'in'),
('IN-AR', 'Arunachal Pradesh', 'in'),
('IN-AS', 'Assam', 'in'),
('IN-BR', 'Bihar', 'in'),
('IN-CH', 'Chandigarh', 'in'),
('IN-CT', 'Chhattisgarh', 'in'),
('IN-DN', 'Dadra and Nagar Haveli and Daman and Diu', 'in'),
('IN-DD', 'Daman and Diu', 'in'), -- These IDs are consolidated now, but adding separately for compatibility
('IN-DL', 'Delhi', 'in'),
('IN-GA', 'Goa', 'in'),
('IN-GJ', 'Gujarat', 'in'),
('IN-HR', 'Haryana', 'in'),
('IN-HP', 'Himachal Pradesh', 'in'),
('IN-JH', 'Jharkhand', 'in'),
('IN-KA', 'Karnataka', 'in'),
('IN-KL', 'Kerala', 'in'),
('IN-LD', 'Lakshadweep', 'in'),
('IN-MP', 'Madhya Pradesh', 'in'),
('IN-MH', 'Maharashtra', 'in'),
('IN-MN', 'Manipur', 'in'),
('IN-ML', 'Meghalaya', 'in'),
('IN-MZ', 'Mizoram', 'in'),
('IN-NL', 'Nagaland', 'in'),
('IN-OR', 'Odisha', 'in'),
('IN-PY', 'Puducherry', 'in'),
('IN-PB', 'Punjab', 'in'),
('IN-RJ', 'Rajasthan', 'in'),
('IN-SK', 'Sikkim', 'in'),
('IN-TN', 'Tamil Nadu', 'in'),
('IN-TG', 'Telangana', 'in'),
('IN-TR', 'Tripura', 'in'),
('IN-UP', 'Uttar Pradesh', 'in'),
('IN-UT', 'Uttarakhand', 'in'),
('IN-WB', 'West Bengal', 'in')
ON CONFLICT (id) DO NOTHING;

12
sql/012_au.sql Normal file
View file

@ -0,0 +1,12 @@
INSERT INTO "worldTravelCountryRegions" (id, name, country_code)
VALUES
('AU-NSW', 'New South Wales', 'au'),
('AU-VIC', 'Victoria', 'au'),
('AU-QLD', 'Queensland', 'au'),
('AU-SA', 'South Australia', 'au'),
('AU-WA', 'Western Australia', 'au'),
('AU-TAS', 'Tasmania', 'au'),
('AU-NT', 'Northern Territory', 'au'),
('AU-ACT', 'Australian Capital Territory', 'au')
ON CONFLICT (id) DO NOTHING;

20
sql/013_nz.sql Normal file
View file

@ -0,0 +1,20 @@
INSERT INTO "worldTravelCountryRegions" (id, name, country_code)
VALUES
('NZ-N', 'Northland', 'nz'),
('NZ-AUK', 'Auckland', 'nz'),
('NZ-WKO', 'Waikato', 'nz'),
('NZ-BOP', 'Bay of Plenty', 'nz'),
('NZ-GIS', 'Gisborne', 'nz'),
('NZ-HKB', 'Hawke''s Bay', 'nz'),
('NZ-TKI', 'Taranaki', 'nz'),
('NZ-MWT', 'Manawatū-Whanganui', 'nz'),
('NZ-WGN', 'Wellington', 'nz'),
('NZ-TAS', 'Tasman', 'nz'),
('NZ-NEL', 'Nelson', 'nz'),
('NZ-MBH', 'Marlborough', 'nz'),
('NZ-WTC', 'West Coast', 'nz'),
('NZ-CAN', 'Canterbury', 'nz'),
('NZ-OTA', 'Otago', 'nz'),
('NZ-STL', 'Southland', 'nz')
ON CONFLICT (id) DO NOTHING;

13
sql/014_za.sql Normal file
View file

@ -0,0 +1,13 @@
INSERT INTO "worldTravelCountryRegions" (id, name, country_code)
VALUES
('ZA-EC', 'Eastern Cape', 'za'),
('ZA-FS', 'Free State', 'za'),
('ZA-GP', 'Gauteng', 'za'),
('ZA-KZN', 'KwaZulu-Natal', 'za'),
('ZA-LP', 'Limpopo', 'za'),
('ZA-MP', 'Mpumalanga', 'za'),
('ZA-NW', 'North West', 'za'),
('ZA-NC', 'Northern Cape', 'za'),
('ZA-WC', 'Western Cape', 'za')
ON CONFLICT (id) DO NOTHING;

31
sql/015_eg.sql Normal file
View file

@ -0,0 +1,31 @@
INSERT INTO "worldTravelCountryRegions" (id, name, country_code)
VALUES
('EG-ALX', 'Alexandria', 'eg'),
('EG-ASN', 'Aswan', 'eg'),
('EG-ASY', 'Asyut', 'eg'),
('EG-BHR', 'Beheira', 'eg'),
('EG-BNS', 'Beni Suef', 'eg'),
('EG-C', 'Cairo', 'eg'),
('EG-DK', 'Dakahlia', 'eg'),
('EG-DAM', 'Damietta', 'eg'),
('EG-FYM', 'Faiyum', 'eg'),
('EG-GH', 'Gharbia', 'eg'),
('EG-GZ', 'Giza', 'eg'),
('EG-IS', 'Ismailia', 'eg'),
('EG-KB', 'Kafr El Sheikh', 'eg'),
('EG-LX', 'Luxor', 'eg'),
('EG-MN', 'Minya', 'eg'),
('EG-MT', 'Matrouh', 'eg'),
('EG-QH', 'Qalyubia', 'eg'),
('EG-KFS', 'Qena', 'eg'),
('EG-SHG', 'Sohag', 'eg'),
('EG-SHR', 'Sharqia', 'eg'),
('EG-SIN', 'South Sinai', 'eg'),
('EG-SW', 'Suez', 'eg'),
('EG-WAD', 'New Valley', 'eg'),
('EG-ASD', 'North Sinai', 'eg'),
('EG-PTS', 'Port Said', 'eg'),
('EG-SKB', 'Suez', 'eg'),
('EG-ESI', 'Ismailia', 'eg')
ON CONFLICT (id) DO NOTHING;

31
sql/016_br.sql Normal file
View file

@ -0,0 +1,31 @@
INSERT INTO "worldTravelCountryRegions" (id, name, country_code)
VALUES
('BR-AC', 'Acre', 'br'),
('BR-AL', 'Alagoas', 'br'),
('BR-AP', 'Amapá', 'br'),
('BR-AM', 'Amazonas', 'br'),
('BR-BA', 'Bahia', 'br'),
('BR-CE', 'Ceará', 'br'),
('BR-DF', 'Federal District', 'br'),
('BR-ES', 'Espírito Santo', 'br'),
('BR-GO', 'Goiás', 'br'),
('BR-MA', 'Maranhão', 'br'),
('BR-MT', 'Mato Grosso', 'br'),
('BR-MS', 'Mato Grosso do Sul', 'br'),
('BR-MG', 'Minas Gerais', 'br'),
('BR-PA', 'Pará', 'br'),
('BR-PB', 'Paraíba', 'br'),
('BR-PR', 'Paraná', 'br'),
('BR-PE', 'Pernambuco', 'br'),
('BR-PI', 'Piauí', 'br'),
('BR-RJ', 'Rio de Janeiro', 'br'),
('BR-RN', 'Rio Grande do Norte', 'br'),
('BR-RS', 'Rio Grande do Sul', 'br'),
('BR-RO', 'Rondônia', 'br'),
('BR-RR', 'Roraima', 'br'),
('BR-SC', 'Santa Catarina', 'br'),
('BR-SP', 'São Paulo', 'br'),
('BR-SE', 'Sergipe', 'br'),
('BR-TO', 'Tocantins', 'br')
ON CONFLICT (id) DO NOTHING;

15
sql/parks.sql Normal file
View file

@ -0,0 +1,15 @@
INSERT INTO "featuredAdventures" (name, location) VALUES
('Yellowstone National Park', 'Wyoming, Montana, Idaho, USA'),
('Yosemite National Park', 'California, USA'),
('Banff National Park', 'Alberta, Canada'),
('Kruger National Park', 'Limpopo, South Africa'),
('Grand Canyon National Park', 'Arizona, USA'),
('Great Smoky Mountains National Park', 'North Carolina, Tennessee, USA'),
('Zion National Park', 'Utah, USA'),
('Glacier National Park', 'Montana, USA'),
('Rocky Mountain National Park', 'Colorado, USA'),
('Everglades National Park', 'Florida, USA'),
('Arches National Park', 'Utah, USA'),
('Acadia National Park', 'Maine, USA'),
('Sequoia National Park', 'California, USA')
ON CONFLICT (name) DO NOTHING;

View file

@ -6,10 +6,12 @@
export let type: String;
export let name: String;
export let location: String;
export let created: string;
export let id: Number;
export let name: String | undefined = undefined;
export let location: String | undefined = undefined;
export let created: String | undefined = undefined;
export let id: Number | undefined = undefined;
export let regionId: String | undefined = undefined;
export let visited: Boolean | undefined = undefined;
function remove() {
dispatch("remove", id);
@ -20,6 +22,14 @@
function add() {
dispatch("add", { name, location });
}
function markVisited() {
dispatch("markVisited", regionId);
visited = true;
}
function removeVisit() {
dispatch("removeVisit", regionId);
visited = false;
}
</script>
{#if type === "mylog"}
@ -75,3 +85,52 @@
</div>
</div>
{/if}
{#if type === "shared"}
<div
class="card min-w-max lg:w-96 md:w-80 sm:w-60 xs:w-40 bg-neutral shadow-xl overflow-hidden"
>
<div class="card-body">
<h2 class="card-title overflow-ellipsis">{name}</h2>
{#if location !== ""}
<p>
<img
src={locationDot}
class="inline-block -mt-1 mr-1"
alt="Logo"
/>{location}
</p>
{/if}
{#if created !== ""}
<p>
<img
src={calendar}
class="inline-block -mt-1 mr-1"
alt="Logo"
/>{created}
</p>
{/if}
</div>
</div>
{/if}
{#if type === "worldtravelregion"}
<div
class="card min-w-max lg:w-96 md:w-80 sm:w-60 xs:w-40 bg-neutral shadow-xl overflow-hidden"
>
<div class="card-body">
<h2 class="card-title overflow-ellipsis">{name}</h2>
<p>{regionId}</p>
<div class="card-actions justify-end">
{#if !visited}
<button class="btn btn-primary" on:click={markVisited}
>Mark Visited</button
>
{/if}
{#if visited}
<button class="btn btn-warning" on:click={removeVisit}>Remove</button>
{/if}
</div>
</div>
</div>
{/if}

View file

@ -50,7 +50,7 @@
class="text-primary-500 underline">Source Code</a
>
</p>
<p class="py-1">Made with ❤️ in Connecticut.</p>
<p class="py-1">Made with ❤️ in the United States.</p>
<div
class="modal-action items-center"
style="display: flex; flex-direction: column; align-items: center; width: 100%;"

View file

@ -20,9 +20,12 @@
async function toToLogin() {
goto("/login");
}
async function toToSignup() {
async function goToSignup() {
goto("/signup");
}
async function goToWorldTravel() {
goto("/worldtravel");
}
let count = 0;
@ -68,6 +71,10 @@
>My Log</button
>
{/if}
<button
class="btn btn-primary my-2 md:my-0 md:mr-4"
on:click={goToWorldTravel}>World Tavel Log</button
>
<button class="btn btn-primary my-2 md:my-0" on:click={goToFeatured}
>Featured</button
>
@ -82,7 +89,7 @@
<div class="navbar-end flex justify-around md:justify-end mr-4">
{#if !user}
<button class="btn btn-primary ml-4" on:click={toToLogin}>Login</button>
<button class="btn btn-primary ml-4" on:click={toToSignup}>Signup</button>
<button class="btn btn-primary ml-4" on:click={goToSignup}>Signup</button>
{/if}
{#if user}

View file

@ -4,6 +4,6 @@
<div class="toast toast-top toast-end z-50">
<div class="alert alert-info">
<span>Adventure {action} successfully!</span>
<span>{action}</span>
</div>
</div>

View file

@ -1,3 +1,3 @@
export let appVersion = "Web 0.0.1";
export let appVersion = "Web 0.1.5-alpha";
export let appTitle = "AdventureLog";
export let copyrightYear = "2024"

View file

@ -5,17 +5,20 @@ import {
json,
serial,
varchar,
integer,
} from "drizzle-orm/pg-core";
export const featuredAdventures = pgTable("featuredAdventures", {
id: serial("id").primaryKey(),
name: text("name").notNull(),
name: text("name").notNull().unique(),
location: text("location"),
});
export const sharedAdventures = pgTable("sharedAdventures", {
id: text("id").primaryKey(),
data: json("data").notNull(),
name: text("name").notNull(),
date: text("date").notNull(),
});
export const userTable = pgTable("user", {
@ -49,3 +52,28 @@ export const userVisitedAdventures = pgTable("userVisitedAdventures", {
location: text("location"),
visitedDate: text("visited_date"),
});
export const worldTravelCountries = pgTable("worldTravelCountries", {
id: serial("id").primaryKey(),
name: text("name").notNull(),
country_code: text("country_code").notNull().unique(),
continent: text("continent").notNull(),
});
export const worldTravelCountryRegions = pgTable("worldTravelCountryRegions", {
id: varchar("id").primaryKey(),
name: text("name").notNull(),
country_code: text("country_code")
.notNull()
.references(() => worldTravelCountries.country_code),
});
export const userVisitedWorldTravel = pgTable("userVisitedWorldTravel", {
id: serial("id").primaryKey(),
userId: text("user_id")
.notNull()
.references(() => userTable.id),
region_id: varchar("region_id")
.notNull()
.references(() => worldTravelCountryRegions.id),
});

View file

@ -1,4 +1,32 @@
// place files you want to import through the `$lib` alias in this folder.
import inspirationalQuotes from "./json/quotes.json";
import countryCodes from "./json/countries.json";
/**
* Converts a country code to its corresponding country name.
* @param countryCode - The country code to convert.
* @returns The country name if found, otherwise null.
*/
export function countryCodeToName(countryCode: string): string | null {
// Look up the country name using the provided country code
const countryName = countryCodes[countryCode.toLowerCase() as keyof typeof countryCodes];
// Return the country name if found, otherwise return null
return countryName || null;
}
/**
* Generates the URL for a flag image based on the specified size and country code.
* @param size - The desired height of the flag image. Avaliable sizes: 20, 24, 40, 60, 80, 120, 240.
* @param country - The 2 digit country code representing the desired flag.
* @returns The URL of the flag image.
*/
export function getFlag(size:number,country: string) {
return `https://flagcdn.com/h${size}/${country}.png`;
}
/**
* Generates a random string consisting of alphanumeric characters.
* @returns {string} The randomly generated string.
*/
export function generateRandomString() {
let randomString = "";
const digits =
@ -11,76 +39,14 @@ export function generateRandomString() {
return randomString;
}
const inspirationalQuotes = [
"Believe you can and you're halfway there. - Theodore Roosevelt",
"The only way to do great work is to love what you do. - Steve Jobs",
"In the middle of every difficulty lies opportunity. - Albert Einstein",
"The future belongs to those who believe in the beauty of their dreams. - Eleanor Roosevelt",
"It does not matter how slowly you go as long as you do not stop. - Confucius",
"Success is not final, failure is not fatal: It is the courage to continue that counts. - Winston Churchill",
"The only limit to our realization of tomorrow will be our doubts of today. - Franklin D. Roosevelt",
"Don't watch the clock; do what it does. Keep going. - Sam Levenson",
"You are never too old to set another goal or to dream a new dream. - C.S. Lewis",
"The only person you are destined to become is the person you decide to be. - Ralph Waldo Emerson",
"Happiness is not something ready-made. It comes from your own actions. - Dalai Lama",
"Life is what happens when you're busy making other plans. - John Lennon",
"You miss 100% of the shots you don't take. - Wayne Gretzky",
"The best time to plant a tree was 20 years ago. The second best time is now. - Chinese Proverb",
"The only way to achieve the impossible is to believe it is possible. - Charles Kingsleigh",
"Don't count the days, make the days count. - Muhammad Ali",
"You don't have to be great to start, but you have to start to be great. - Zig Ziglar",
"You can't go back and change the beginning, but you can start where you are and change the ending. - C.S. Lewis",
"Dream big and dare to fail. - Norman Vaughan",
"The secret of getting ahead is getting started. - Mark Twain",
"Everything you can imagine is real. - Pablo Picasso",
"You must be the change you wish to see in the world. - Mahatma Gandhi",
"If you want to lift yourself up, lift up someone else. - Booker T. Washington",
"Believe in yourself and all that you are. Know that there is something inside you that is greater than any obstacle. - Christian D. Larson",
"The journey of a thousand miles begins with one step. - Lao Tzu",
"Life isn't about waiting for the storm to pass, it's about learning to dance in the rain. - Vivian Greene",
"You are never too old to set another goal or to dream a new dream. - Les Brown",
"Your time is limited, don't waste it living someone else's life. - Steve Jobs",
"Don't let yesterday take up too much of today. - Will Rogers",
"The only thing standing between you and your goal is the story you keep telling yourself as to why you can't achieve it. - Jordan Belfort",
"The future belongs to those who prepare for it today. - Malcolm X",
"The greatest glory in living lies not in never falling, but in rising every time we fall. - Nelson Mandela",
"It's not what happens to you, but how you react to it that matters. - Epictetus",
"The only way to do great work is to love what you do. - Steve Jobs",
"When one door of happiness closes, another opens, but often we look so long at the closed door that we do not see the one that has been opened for us. - Helen Keller",
"The only thing that stands between you and your dream is the will to try and the belief that it is actually possible. - Joel Brown",
"Success is walking from failure to failure with no loss of enthusiasm. - Winston Churchill",
"Believe in yourself! Have faith in your abilities! Without a humble but reasonable confidence in your own powers you cannot be successful or happy. - Norman Vincent Peale",
"The greatest adventure is what lies ahead. - J.R.R. Tolkien",
"The only way to do great work is to love what you do. - Steve Jobs",
"What you get by achieving your goals is not as important as what you become by achieving your goals. - Zig Ziglar",
"To be yourself in a world that is constantly trying to make you something else is the greatest accomplishment. - Ralph Waldo Emerson",
"What lies behind us and what lies before us are tiny matters compared to what lies within us. - Ralph Waldo Emerson",
"The only person you are destined to become is the person you decide to be. - Ralph Waldo Emerson",
"The best and most beautiful things in the world cannot be seen or even touched - they must be felt with the heart. - Helen Keller",
"The only limit to our realization of tomorrow will be our doubts of today. - Franklin D. Roosevelt",
"It always seems impossible until it is done. - Nelson Mandela",
"I can't change the direction of the wind, but I can adjust my sails to always reach my destination. - Jimmy Dean",
"Believe you can and you're halfway there. - Theodore Roosevelt",
"The only way to achieve the impossible is to believe it is possible. - Charles Kingsleigh",
"If you're going through hell, keep going. - Winston Churchill",
"Nothing is impossible, the word itself says 'I'm possible'! - Audrey Hepburn",
"The only thing standing in the way between you and your goal is the story you keep telling yourself as to why you can't achieve it. - Jordan Belfort",
"The future belongs to those who believe in the beauty of their dreams. - Eleanor Roosevelt",
"Success is not final, failure is not fatal: It is the courage to continue that counts. - Winston Churchill",
"Keep your face always toward the sunshine - and shadows will fall behind you. - Walt Whitman",
"Success is not the key to happiness. Happiness is the key to success. If you love what you are doing, you will be successful. - Albert Schweitzer",
"Don't watch the clock; do what it does. Keep going. - Sam Levenson",
"You are never too old to set another goal or to dream a new dream. - C.S. Lewis",
"You are never too old to set another goal or to dream a new dream. - C.S. Lewis",
"The only person you are destined to become is the person you decide to be. - Ralph Waldo Emerson",
"Happiness is not something ready-made. It comes from your own actions. - Dalai Lama",
"Life is what happens when you're busy making other plans. - John Lennon",
"You miss 100% of the shots you don't take. - Wayne Gretzky",
"The best time to plant a tree was 20 years ago. The second best time is now. - Chinese Proverb",
"The only way to achieve the impossible is to believe it is possible. - Charles Kings",
];
const quotes = inspirationalQuotes.quotes;
/**
* Retrieves a random quote from the quotes array.
* @returns A formatted string containing the random quote and its author.
*/
export function getRandomQuote() {
const randomIndex = Math.floor(Math.random() * inspirationalQuotes.length);
return inspirationalQuotes[randomIndex];
const randomIndex = Math.floor(Math.random() * quotes.length);
let quoteString = quotes[randomIndex].quote;
let authorString = quotes[randomIndex].author;
return "\"" + quoteString + "\" - " + authorString;
}

View file

@ -0,0 +1,17 @@
{
"us": "United States",
"de": "Germany",
"fr": "France",
"gb": "United Kingdom",
"ar": "Argentina",
"mx": "Mexico",
"jp": "Japan",
"cn": "China",
"in": "India",
"au": "Australia",
"nz": "New Zealand",
"za": "South Africa",
"eg": "Egypt",
"ca": "Canada",
"br": "Brazil"
}

192
src/lib/json/quotes.json Normal file
View file

@ -0,0 +1,192 @@
{
"quotes": [
{
"quote": "Believe you can and you're halfway there.",
"author": "Theodore Roosevelt"
},
{
"quote": "The only way to do great work is to love what you do.",
"author": "Steve Jobs"
},
{
"quote": "In the middle of every difficulty lies opportunity.",
"author": "Albert Einstein"
},
{
"quote": "The future belongs to those who believe in the beauty of their dreams.",
"author": "Eleanor Roosevelt"
},
{
"quote": "It does not matter how slowly you go as long as you do not stop.",
"author": "Confucius"
},
{
"quote": "Success is not final, failure is not fatal: It is the courage to continue that counts.",
"author": "Winston Churchill"
},
{
"quote": "The only limit to our realization of tomorrow will be our doubts of today.",
"author": "Franklin D. Roosevelt"
},
{
"quote": "Don't watch the clock; do what it does. Keep going.",
"author": "Sam Levenson"
},
{
"quote": "You are never too old to set another goal or to dream a new dream.",
"author": "C.S. Lewis"
},
{
"quote": "The only person you are destined to become is the person you decide to be.",
"author": "Ralph Waldo Emerson"
},
{
"quote": "Happiness is not something ready-made. It comes from your own actions.",
"author": "Dalai Lama"
},
{
"quote": "Life is what happens when you're busy making other plans.",
"author": "John Lennon"
},
{
"quote": "You miss 100% of the shots you don't take.",
"author": "Wayne Gretzky"
},
{
"quote": "The best time to plant a tree was 20 years ago. The second best time is now.",
"author": "Chinese Proverb"
},
{
"quote": "The only way to achieve the impossible is to believe it is possible.",
"author": "Charles Kingsleigh"
},
{
"quote": "Don't count the days, make the days count.",
"author": "Muhammad Ali"
},
{
"quote": "You don't have to be great to start, but you have to start to be great.",
"author": "Zig Ziglar"
},
{
"quote": "You can't go back and change the beginning, but you can start where you are and change the ending.",
"author": "C.S. Lewis"
},
{
"quote": "Dream big and dare to fail.",
"author": "Norman Vaughan"
},
{
"quote": "The secret of getting ahead is getting started.",
"author": "Mark Twain"
},
{
"quote": "Everything you can imagine is real.",
"author": "Pablo Picasso"
},
{
"quote": "You must be the change you wish to see in the world.",
"author": "Mahatma Gandhi"
},
{
"quote": "If you want to lift yourself up, lift up someone else.",
"author": "Booker T. Washington"
},
{
"quote": "Believe in yourself and all that you are. Know that there is something inside you that is greater than any obstacle.",
"author": "Christian D. Larson"
},
{
"quote": "The journey of a thousand miles begins with one step.",
"author": "Lao Tzu"
},
{
"quote": "Life isn't about waiting for the storm to pass, it's about learning to dance in the rain.",
"author": "Vivian Greene"
},
{
"quote": "You are never too old to set another goal or to dream a new dream.",
"author": "Les Brown"
},
{
"quote": "Your time is limited, don't waste it living someone else's life.",
"author": "Steve Jobs"
},
{
"quote": "Don't let yesterday take up too much of today.",
"author": "Will Rogers"
},
{
"quote": "The only thing standing between you and your goal is the story you keep telling yourself as to why you can't achieve it.",
"author": "Jordan Belfort"
},
{
"quote": "The future belongs to those who prepare for it today.",
"author": "Malcolm X"
},
{
"quote": "The greatest glory in living lies not in never falling, but in rising every time we fall.",
"author": "Nelson Mandela"
},
{
"quote": "It's not what happens to you, but how you react to it that matters.",
"author": "Epictetus"
},
{
"quote": "When one door of happiness closes, another opens, but often we look so long at the closed door that we do not see the one that has been opened for us.",
"author": "Helen Keller"
},
{
"quote": "The only thing that stands between you and your dream is the will to try and the belief that it is actually possible.",
"author": "Joel Brown"
},
{
"quote": "Success is walking from failure to failure with no loss of enthusiasm.",
"author": "Winston Churchill"
},
{
"quote": "Believe in yourself! Have faith in your abilities! Without a humble but reasonable confidence in your own powers you cannot be successful or happy.",
"author": "Norman Vincent Peale"
},
{
"quote": "The greatest adventure is what lies ahead.",
"author": "J.R.R. Tolkien"
},
{
"quote": "What you get by achieving your goals is not as important as what you become by achieving your goals.",
"author": "Zig Ziglar"
},
{
"quote": "To be yourself in a world that is constantly trying to make you something else is the greatest accomplishment.",
"author": "Ralph Waldo Emerson"
},
{
"quote": "What lies behind us and what lies before us are tiny matters compared to what lies within us.",
"author": "Ralph Waldo Emerson"
},
{
"quote": "The best and most beautiful things in the world cannot be seen or even touched - they must be felt with the heart.",
"author": "Helen Keller"
},
{
"quote": "I can't change the direction of the wind, but I can adjust my sails to always reach my destination.",
"author": "Jimmy Dean"
},
{
"quote": "If you're going through hell, keep going.",
"author": "Winston Churchill"
},
{
"quote": "Nothing is impossible, the word itself says 'I'm possible'!",
"author": "Audrey Hepburn"
},
{
"quote": "Keep your face always toward the sunshine - and shadows will fall behind you.",
"author": "Walt Whitman"
},
{
"quote": "Success is not the key to happiness. Happiness is the key to success. If you love what you are doing, you will be successful.",
"author": "Albert Schweitzer"
}
]
}

View file

@ -0,0 +1,77 @@
import type { RequestEvent } from "@sveltejs/kit";
import { db } from "$lib/db/db.server";
import { userVisitedAdventures, userVisitedWorldTravel } from "$lib/db/schema";
import { and, eq } from "drizzle-orm";
export async function POST(event: RequestEvent): Promise<Response> {
if (!event.locals.user) {
return new Response(JSON.stringify({ error: "Unauthorized" }), {
status: 401,
headers: {
"Content-Type": "application/json",
},
});
}
let body = await event.request.json();
let res = await db
.insert(userVisitedWorldTravel)
.values({
userId: event.locals.user.id,
region_id: body.region_id,
})
.execute();
return new Response(JSON.stringify({ res: res }), {
status: 200,
headers: {
"Content-Type": "application/json",
},
});
}
export async function GET(event: RequestEvent): Promise<Response> {
if (!event.locals.user) {
return new Response(JSON.stringify({ error: "Unauthorized" }), {
status: 401,
headers: {
"Content-Type": "application/json",
},
});
}
let res = await db
.select()
.from(userVisitedWorldTravel)
.where(eq(userVisitedWorldTravel.userId,event.locals.user.id));
return new Response(JSON.stringify({ res: res }), {
status: 200,
headers: {
"Content-Type": "application/json",
},
});
}
export async function DELETE(event: RequestEvent): Promise<Response> {
if (!event.locals.user) {
return new Response(JSON.stringify({ error: "Unauthorized" }), {
status: 401,
headers: {
"Content-Type": "application/json",
},
});
}
let body = await event.request.json();
let res = await db
.delete(userVisitedWorldTravel)
.where(
and(
eq(userVisitedWorldTravel.userId, event.locals.user.id),
eq(userVisitedWorldTravel.region_id, body.region_id),
)
)
.execute();
return new Response(JSON.stringify({ res: res }), {
status: 200,
headers: {
"Content-Type": "application/json",
},
});
}

View file

@ -2,13 +2,15 @@ import { db } from "$lib/db/db.server";
import { sharedAdventures } from "$lib/db/schema";
import type { Adventure } from "$lib/utils/types";
export async function POST({ request }: { request: Request }) {
export async function POST({ request, locals }) {
const { key, data } = await request.json();
let adventure = data as Adventure;
console.log(adventure);
let date = new Date().toISOString().split("T")[0];
let name = locals.user ? locals.user.username : "Anonymous";
await db
.insert(sharedAdventures)
.values({ id: key, data: adventure })
.values({ id: key, data: adventure, name:name, date:date })
.execute();
return new Response(JSON.stringify({ key: key }));
}
}

View file

@ -5,15 +5,8 @@
import AdventureCard from "$lib/components/AdventureCard.svelte";
import type { Adventure } from "$lib/utils/types";
import {
addAdventure,
clearAdventures,
getAdventures,
getNextId,
} from "../../services/adventureService";
import { onMount } from "svelte";
import { exportData } from "../../services/export";
import { importData } from "../../services/import";
import exportFile from "$lib/assets/exportFile.svg";
import deleteIcon from "$lib/assets/deleteIcon.svg";
import SucessToast from "$lib/components/SucessToast.svelte";
@ -48,12 +41,10 @@
function showToast(action: string) {
toastAction = action;
isShowingToast = true;
console.log("showing toast");
setTimeout(() => {
isShowingToast = false;
toastAction = "";
console.log("hiding toast");
}, 3000);
}
@ -87,7 +78,7 @@
];
newName = ""; // Reset newName and newLocation after adding adventure
newLocation = "";
showToast("added");
showToast("Adventure added successfully!");
visitCount.update((n) => n + 1);
})
.catch((error) => {
@ -121,7 +112,7 @@
editName = "";
editLocation = "";
editCreated = "";
showToast("edited");
showToast("Adventure edited successfully!");
})
.catch((error) => {
console.error("Error:", error);
@ -155,6 +146,7 @@
console.log("Success:", data);
let url = window.location.origin + "/shared/" + key;
navigator.clipboard.writeText(url);
showToast("Link copied to clipboard!");
})
.catch((error) => {
console.error("Error:", error);
@ -180,7 +172,7 @@
console.log("Success:", data);
// remove adventure from array where id matches
adventures = [];
showToast("removed");
showToast("Adventure removed successfully!");
visitCount.set(0);
})
.catch((error) => {
@ -205,7 +197,7 @@
adventures = adventures.filter(
(adventure) => adventure.id !== event.detail,
);
showToast("removed");
showToast("Adventure removed successfully!");
visitCount.update((n) => n - 1);
})
.catch((error) => {

View file

@ -35,7 +35,7 @@
<div class="flex justify-center mt-12 mr-25 ml-25">
<blockquote class="w-80 text-center text-lg break-words">
{#if quote != ""}
"{quote}"
{quote}
{/if}
<!-- <footer class="text-sm">- Steve Jobs</footer> -->
</blockquote>

View file

@ -5,14 +5,38 @@ import type { Adventure } from "$lib/utils/types";
export async function load({ params }) {
let key = params.key;
// Fetch data from the database
let result = await db
.select()
.from(sharedAdventures)
.where(eq(sharedAdventures.id, key))
.execute();
let adventure = result[0].data as Adventure;
console.log(adventure);
// Assuming result is an array with a single object
let rawData = result[0];
// Parse the data field, which contains a JSON string
let adventures = JSON.parse(rawData.data as string);
// Map the parsed adventures to the Adventure interface
let adventureArray = adventures.map((item: any) => {
return {
id: item.id,
name: item.name,
location: item.location,
created: item.created,
} as Adventure;
});
let name = rawData.name;
let date = rawData.date;
// Return the array of Adventure objects
return {
result: adventure,
adventureArray,
name,
date,
};
}

View file

@ -1,7 +1,31 @@
<script lang="ts">
import type { Adventure } from "$lib/utils/types";
export let data;
let result = data.result;
let array = data.adventureArray as Adventure[];
import AdventureCard from "$lib/components/AdventureCard.svelte";
</script>
<p>{result}</p>
<!-- loop through each adventure -->
<!-- {#each array as adventure}
<div>
<h1>{adventure.name}</h1>
<p>{adventure.location}</p>
<p>{adventure.created}</p>
<p>{adventure.id}</p>
</div>
{/each} -->
<h1 class="text-center font-bold text-4xl">Shared Adventure List</h1>
<h2 class="text-center text-2xl">By {data.name} on {data.date}</h2>
<div
class="grid xl:grid-cols-3 lg:grid-cols-3 md:grid-cols-2 sm:grid-cols-1 gap-4 mt-4 content-center auto-cols-auto ml-6 mr-6"
>
{#each array as adventure (adventure.id)}
<AdventureCard
type="shared"
id={adventure.id}
name={adventure.name}
location={adventure.location}
created={adventure.created}
/>
{/each}
</div>

View file

@ -47,7 +47,7 @@
<div class="flex justify-center mt-12 mr-25 ml-25">
<blockquote class="w-80 text-center text-lg break-words">
{#if quote != ""}
"{quote}"
{quote}
{/if}
<!-- <footer class="text-sm">- Steve Jobs</footer> -->
</blockquote>

View file

@ -0,0 +1,19 @@
import { redirect } from "@sveltejs/kit";
import type { PageServerLoad } from "./$types";
import type { Adventure } from "$lib/utils/types";
import { db } from "$lib/db/db.server";
import { worldTravelCountries } from "$lib/db/schema";
export const load: PageServerLoad = async () => {
// if (!event.locals.user) {
// return redirect(302, "/login");
// }
let response = await db
.select()
.from(worldTravelCountries)
// let array = result.adventures as Adventure[];
return {
response,
};
};

View file

@ -0,0 +1,27 @@
<script lang="ts">
import { goto } from "$app/navigation";
import { getFlag } from "$lib";
import AdventureCard from "$lib/components/AdventureCard.svelte";
export let data: any;
async function nav(loc: string) {
goto(`/worldtravel/${loc}`);
}
</script>
<h1 class="text-center font-bold text-4xl mb-4">Country List</h1>
{#each data.response as item}
<button
class="btn btn-primary mr-4 mb-2"
on:click={() => nav(item.country_code)}
>{item.name}
<img
src={getFlag(24, item.country_code)}
class="inline-block -mt-1 mr-1"
alt="Flag"
/></button
>
<!-- <p>Name: {item.name}, Continent: {item.continent}</p> -->
{/each}

View file

@ -0,0 +1,28 @@
import { db } from '$lib/db/db.server.js';
import { userVisitedWorldTravel, worldTravelCountryRegions } from '$lib/db/schema.js';
import { eq } from 'drizzle-orm';
import type { PageServerLoad } from './$types';
export const load: PageServerLoad = async ({ params, locals }) => {
const { countrycode } = params;
let data = await db
.select()
.from(worldTravelCountryRegions)
.where(eq(worldTravelCountryRegions.country_code, countrycode))
let visitedRegions: { id: number; userId: string; region_id: string; }[] = [];
if (locals.user) {
visitedRegions = await db
.select()
.from(userVisitedWorldTravel)
.where(eq(userVisitedWorldTravel.userId, locals.user.id))
.execute();
}
return {
regions : data,
countrycode: countrycode,
visitedRegions: visitedRegions,
};
}

View file

@ -0,0 +1,74 @@
<script lang="ts">
export let data;
import AdventureCard from "$lib/components/AdventureCard.svelte";
import { countryCodeToName } from "$lib";
import { getFlag } from "$lib";
import { goto } from "$app/navigation";
import { onMount } from "svelte";
function markVisited(event: { detail: string }) {
console.log(`Marked ${event.detail} as visited`);
fetch("/api/regionvisit", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
region_id: event.detail,
}),
}).then((response) => {
if (response.status === 401) {
goto("/login");
}
return response.json();
});
}
function removeVisit(event: { detail: string }) {
console.log(`Removed visit to ${event.detail}`);
fetch("/api/regionvisit", {
method: "DELETE",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
region_id: event.detail,
}),
}).then((response) => {
if (response.status === 401) {
goto("/login");
}
return response.json();
});
}
onMount(() => {
console.log(data.visitedRegions);
});
</script>
<h1 class="text-center text-4xl font-bold">
Regions in {countryCodeToName(data.countrycode)}
<img
src={getFlag(40, data.countrycode)}
class="inline-block -mt-1 mr-1"
alt="Flag"
/>
</h1>
<div
class="grid xl:grid-cols-3 lg:grid-cols-3 md:grid-cols-2 sm:grid-cols-1 gap-4 mt-4 content-center auto-cols-auto ml-6 mr-6"
>
{#each data.regions as region (region.id)}
<AdventureCard
type="worldtravelregion"
regionId={region.id}
name={region.name}
on:markVisited={markVisited}
visited={data.visitedRegions.some(
(visitedRegion) => visitedRegion.region_id === region.id,
)}
on:removeVisit={removeVisit}
/>
{/each}
</div>

View file

@ -9,8 +9,22 @@ wait_for_db() {
echo "Database is now available."
}
# Function to run SQL scripts
run_sql_scripts() {
echo "Running SQL scripts..."
# Define the path to your SQL scripts
SQL_SCRIPTS_PATH="/sql" # Replace with the path to your SQL scripts
# Run each SQL script in the directory using the DATABASE_URL
for sql_script in "$SQL_SCRIPTS_PATH"/*.sql; do
echo "Running script: $sql_script"
psql "$DATABASE_URL" -f "$sql_script"
done
echo "Finished running SQL scripts."
}
# Start your application here
# Example: node build/index.js
# Print message
echo "Starting AdventureLog"
@ -18,11 +32,14 @@ echo "Starting AdventureLog"
wait_for_db
# generate the schema
npm run generate
# npm run generate
# Run database migration
npm run migrate
echo "The orgin to be set is: $ORIGIN"
# Run SQL scripts
run_sql_scripts
echo "The origin to be set is: $ORIGIN"
# Start the application
ORIGIN=$ORIGIN node build

View file

@ -6,6 +6,6 @@ export default {
},
plugins: [require("@tailwindcss/typography"), require("daisyui")],
daisyui: {
themes: ["sunset"],
themes: ["night"],
},
};