feat!: start implementing repo listing & auth middleware

This commit is contained in:
2026-01-15 00:20:14 -08:00
parent 92d409f812
commit 6f2f64fd73
18 changed files with 1982 additions and 21 deletions

View File

@@ -10,9 +10,7 @@
const query = createQuery(() => ({
queryKey: ['github-repositories'],
queryFn: async () => {
const response = await fetch('https://api.github.com/user/repos?affiliation=owner', {
headers: {}
});
const response = await fetch(`/api/${$session.data?.user.id}/repos`);
return await response.json();
}
}));

View File

@@ -1,5 +1,7 @@
import { jwt } from 'better-auth/plugins';
import { createAuthClient } from 'better-auth/svelte';
export const authClient = createAuthClient({
baseURL: 'http://localhost:5173'
baseURL: 'http://localhost:5173',
plugins: [jwt()]
});

View File

@@ -2,12 +2,14 @@ import { betterAuth } from 'better-auth';
import { drizzleAdapter } from 'better-auth/adapters/drizzle';
import { db } from './db/drizzle';
import * as authSchema from './db/auth-schema';
import { jwt } from 'better-auth/plugins';
export const auth = betterAuth({
database: drizzleAdapter(db, {
provider: 'pg',
schema: { ...authSchema }
}),
plugins: [jwt()],
socialProviders: {
github: {
clientId: process.env.GH_CLIENT_ID!,

View File

@@ -73,6 +73,14 @@ export const verification = pgTable(
(table) => [index("verification_identifier_idx").on(table.identifier)],
);
export const jwks = pgTable("jwks", {
id: text("id").primaryKey(),
publicKey: text("public_key").notNull(),
privateKey: text("private_key").notNull(),
createdAt: timestamp("created_at").notNull(),
expiresAt: timestamp("expires_at"),
});
export const userRelations = relations(user, ({ many }) => ({
sessions: many(session),
accounts: many(account),