Skip to content

Commit

Permalink
added github auth and accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
d3rpp committed Aug 23, 2024
1 parent d3259d2 commit 26d466f
Show file tree
Hide file tree
Showing 39 changed files with 1,107 additions and 100 deletions.
5 changes: 4 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Example ENV File, use this to create the .env file.

DATABASE_FILE=./database.db
DATABASE_FILE=./database.db

GITHUB_CLIENT_ID=""
GITHUB_CLIENT_SECRET=""
Binary file modified bun.lockb
Binary file not shown.
13 changes: 13 additions & 0 deletions drizzle/0001_premium_khan.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
CREATE TABLE `oauth_connections` (
`type` text NOT NULL,
`oauth_identifier` text NOT NULL,
`user_id` text NOT NULL,
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action
);
--> statement-breakpoint
CREATE TABLE `sessions` (
`id` text NOT NULL,
`user_id` text NOT NULL,
`expires_at` integer NOT NULL,
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action
);
307 changes: 307 additions & 0 deletions drizzle/meta/0001_snapshot.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,307 @@
{
"version": "6",
"dialect": "sqlite",
"id": "94aceb85-f443-4330-8d38-ec182650c696",
"prevId": "86be13c9-c3e4-4d58-b449-58f12e9dfda3",
"tables": {
"email_addresses": {
"name": "email_addresses",
"columns": {
"email_id": {
"name": "email_id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"autoincrement": true
},
"user_id": {
"name": "user_id",
"type": "text(26)",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"email_address": {
"name": "email_address",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"is_verified": {
"name": "is_verified",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "0"
}
},
"indexes": {
"email_addresses_email_address_unique": {
"name": "email_addresses_email_address_unique",
"columns": ["email_address"],
"isUnique": true
}
},
"foreignKeys": {
"email_addresses_user_id_users_id_fk": {
"name": "email_addresses_user_id_users_id_fk",
"tableFrom": "email_addresses",
"tableTo": "users",
"columnsFrom": ["user_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"oauth_connections": {
"name": "oauth_connections",
"columns": {
"type": {
"name": "type",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"oauth_identifier": {
"name": "oauth_identifier",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"user_id": {
"name": "user_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {
"oauth_connections_user_id_users_id_fk": {
"name": "oauth_connections_user_id_users_id_fk",
"tableFrom": "oauth_connections",
"tableTo": "users",
"columnsFrom": ["user_id"],
"columnsTo": ["id"],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"passwords": {
"name": "passwords",
"columns": {
"user_id": {
"name": "user_id",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"password_hash": {
"name": "password_hash",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {
"passwords_user_id_users_id_fk": {
"name": "passwords_user_id_users_id_fk",
"tableFrom": "passwords",
"tableTo": "users",
"columnsFrom": ["user_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"public_assets": {
"name": "public_assets",
"columns": {
"file_name": {
"name": "file_name",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"type": {
"name": "type",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"blob": {
"name": "blob",
"type": "blob",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"sessions": {
"name": "sessions",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"user_id": {
"name": "user_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"expires_at": {
"name": "expires_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {
"sessions_user_id_users_id_fk": {
"name": "sessions_user_id_users_id_fk",
"tableFrom": "sessions",
"tableTo": "users",
"columnsFrom": ["user_id"],
"columnsTo": ["id"],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"user_aliases": {
"name": "user_aliases",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"autoincrement": true
},
"user_ref": {
"name": "user_ref",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"alias_name": {
"name": "alias_name",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {
"user_aliases_user_ref_users_id_fk": {
"name": "user_aliases_user_ref_users_id_fk",
"tableFrom": "user_aliases",
"tableTo": "users",
"columnsFrom": ["user_ref"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"users": {
"name": "users",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"display_name": {
"name": "display_name",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"username": {
"name": "username",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"profile_picture": {
"name": "profile_picture",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
}
},
"indexes": {
"users_username_unique": {
"name": "users_username_unique",
"columns": ["username"],
"isUnique": true
}
},
"foreignKeys": {
"users_profile_picture_public_assets_file_name_fk": {
"name": "users_profile_picture_public_assets_file_name_fk",
"tableFrom": "users",
"tableTo": "public_assets",
"columnsFrom": ["profile_picture"],
"columnsTo": ["file_name"],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
}
},
"enums": {},
"_meta": {
"schemas": {},
"tables": {},
"columns": {}
},
"internal": {
"indexes": {}
}
}
7 changes: 7 additions & 0 deletions drizzle/meta/_journal.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@
"when": 1724016516054,
"tag": "0000_hot_sage",
"breakpoints": true
},
{
"idx": 1,
"version": "6",
"when": 1724366636684,
"tag": "0001_premium_khan",
"breakpoints": true
}
]
}
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,24 @@
"svelte-preprocess"
],
"dependencies": {
"@lucia-auth/adapter-drizzle": "^1.1.0",
"@tanstack/svelte-query": "^5.51.21",
"@tanstack/svelte-query-devtools": "^5.51.21",
"@trpc/client": "^10.45.2",
"@trpc/server": "^10.45.2",
"arctic": "^1.9.2",
"bits-ui": "^0.21.13",
"clsx": "^2.1.1",
"drizzle-orm": "^0.33.0",
"lucia": "^3.2.0",
"lucide-svelte": "^0.428.0",
"mode-watcher": "^0.4.1",
"svelte-radix": "^1.1.0",
"tailwind-merge": "^2.5.2",
"tailwind-variants": "^0.2.1",
"trpc-svelte-query-adapter": "^2.3.14",
"trpc-sveltekit": "^3.6.2",
"tsafe": "^1.7.2",
"ulid": "^2.3.0",
"zod": "^3.23.8"
}
Expand Down
5 changes: 4 additions & 1 deletion src/app.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
declare global {
namespace App {
// interface Error {}
// interface Locals {}
interface Locals {
user: import("lucia").User | null;
session: import("lucia").Session | null;
}
// interface PageData {}
// interface PageState {}
// interface Platform {}
Expand Down
Loading

0 comments on commit 26d466f

Please sign in to comment.