diff --git a/.env.example b/.env.example index f8a4358..a09de95 100644 --- a/.env.example +++ b/.env.example @@ -25,3 +25,7 @@ POSTGRES_PRISMA_URL=**************************** NEXT_PUBLIC_STACK_PROJECT_ID=**************************** NEXT_PUBLIC_STACK_PUBLISHABLE_CLIENT_KEY=**************************************** STACK_SECRET_SERVER_KEY=*********************** + +# Google Oauth for google login +GOOGLE_CLIENT_ID="" +GOOGLE_CLIENT_SECRET="" diff --git a/drizzle/0002_robust_firedrake.sql b/drizzle/0002_robust_firedrake.sql new file mode 100644 index 0000000..56adb4f --- /dev/null +++ b/drizzle/0002_robust_firedrake.sql @@ -0,0 +1,3 @@ +ALTER TABLE "user" ALTER COLUMN "password_hash" DROP NOT NULL;--> statement-breakpoint +ALTER TABLE "user" ADD COLUMN "google_id" text;--> statement-breakpoint +ALTER TABLE "user" ADD CONSTRAINT "user_google_id_unique" UNIQUE("google_id"); \ No newline at end of file diff --git a/drizzle/meta/0002_snapshot.json b/drizzle/meta/0002_snapshot.json new file mode 100644 index 0000000..26b7434 --- /dev/null +++ b/drizzle/meta/0002_snapshot.json @@ -0,0 +1,122 @@ +{ + "id": "277e5a0d-b5f7-40e3-aaf9-c6cd5fe3d0a0", + "prevId": "d190d67d-4be7-486a-b23e-9106feca588a", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.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": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user": { + "name": "user", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "age": { + "name": "age", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "username": { + "name": "username", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "password_hash": { + "name": "password_hash", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "google_id": { + "name": "google_id", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "user_username_unique": { + "name": "user_username_unique", + "nullsNotDistinct": false, + "columns": [ + "username" + ] + }, + "user_google_id_unique": { + "name": "user_google_id_unique", + "nullsNotDistinct": false, + "columns": [ + "google_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": {}, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/drizzle/meta/_journal.json b/drizzle/meta/_journal.json index bab04b6..0278ccf 100644 --- a/drizzle/meta/_journal.json +++ b/drizzle/meta/_journal.json @@ -15,6 +15,13 @@ "when": 1758905260578, "tag": "0001_complete_namora", "breakpoints": true + }, + { + "idx": 2, + "version": "7", + "when": 1759502119139, + "tag": "0002_robust_firedrake", + "breakpoints": true } ] } \ No newline at end of file diff --git a/package.json b/package.json index d3aac7e..eb7768e 100644 --- a/package.json +++ b/package.json @@ -56,6 +56,7 @@ "dependencies": { "@node-rs/argon2": "^2.0.2", "@sveltejs/adapter-vercel": "^5.10.2", + "arctic": "^3.7.0", "postgres": "^3.4.5", "svelte-maplibre": "^1.2.1" }, diff --git a/src/lib/components/login-form.svelte b/src/lib/components/login-form.svelte index 85e28b1..77e9e7e 100644 --- a/src/lib/components/login-form.svelte +++ b/src/lib/components/login-form.svelte @@ -1,5 +1,6 @@