Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0019511061 | |||
| 9a0a63d1df | |||
| 24a032dd9d | |||
| 13f2550ee2 | |||
| f29ac2e40d | |||
| bdcad0d9dc | |||
| b1124e6a6c | |||
| 90794e4e14 | |||
| 373e35ef8e | |||
| 46416586ea | |||
| 515389e067 | |||
| 191e3499fc | |||
| 921d708ccd | |||
| 8bfc6c970b | |||
| b8b054316c |
+16
-18
@@ -1,7 +1,6 @@
|
|||||||
import { betterAuth } from "better-auth";
|
import { betterAuth } from "better-auth";
|
||||||
import { drizzleAdapter } from "better-auth/adapters/drizzle";
|
import { drizzleAdapter } from "better-auth/adapters/drizzle";
|
||||||
import { genericOAuth } from "better-auth/plugins";
|
import { genericOAuth } from "better-auth/plugins";
|
||||||
import { google, github } from "better-auth/social-providers";
|
|
||||||
import { getDb, authProviderConfig, eq } from "@groombook/db";
|
import { getDb, authProviderConfig, eq } from "@groombook/db";
|
||||||
import { decryptSecret } from "@groombook/db";
|
import { decryptSecret } from "@groombook/db";
|
||||||
|
|
||||||
@@ -173,22 +172,6 @@ export async function initAuth(): Promise<void> {
|
|||||||
|
|
||||||
const callbackBase = `${BETTER_AUTH_URL}/api/auth/callback`;
|
const callbackBase = `${BETTER_AUTH_URL}/api/auth/callback`;
|
||||||
|
|
||||||
const socialPlugins = [];
|
|
||||||
if (hasGoogle) {
|
|
||||||
socialPlugins.push(google({
|
|
||||||
clientId: process.env.GOOGLE_CLIENT_ID!,
|
|
||||||
clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
|
|
||||||
redirectURI: `${callbackBase}/google`,
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
if (hasGitHub) {
|
|
||||||
socialPlugins.push(github({
|
|
||||||
clientId: process.env.GITHUB_CLIENT_ID!,
|
|
||||||
clientSecret: process.env.GITHUB_CLIENT_SECRET!,
|
|
||||||
redirectURI: `${callbackBase}/github`,
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Build Better-Auth instance using resolved config
|
// Build Better-Auth instance using resolved config
|
||||||
authInstance = betterAuth({
|
authInstance = betterAuth({
|
||||||
database: drizzleAdapter(db, {
|
database: drizzleAdapter(db, {
|
||||||
@@ -216,8 +199,23 @@ export async function initAuth(): Promise<void> {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
...socialPlugins,
|
|
||||||
],
|
],
|
||||||
|
socialProviders: {
|
||||||
|
...(hasGoogle ? {
|
||||||
|
google: {
|
||||||
|
clientId: process.env.GOOGLE_CLIENT_ID!,
|
||||||
|
clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
|
||||||
|
redirectURI: `${callbackBase}/google`,
|
||||||
|
},
|
||||||
|
} : {}),
|
||||||
|
...(hasGitHub ? {
|
||||||
|
github: {
|
||||||
|
clientId: process.env.GITHUB_CLIENT_ID!,
|
||||||
|
clientSecret: process.env.GITHUB_CLIENT_SECRET!,
|
||||||
|
redirectURI: `${callbackBase}/github`,
|
||||||
|
},
|
||||||
|
} : {}),
|
||||||
|
},
|
||||||
session: {
|
session: {
|
||||||
expiresIn: 60 * 60 * 24 * 7, // 7 days
|
expiresIn: 60 * 60 * 24 * 7, // 7 days
|
||||||
updateAge: 60 * 60 * 24, // 1 day
|
updateAge: 60 * 60 * 24, // 1 day
|
||||||
|
|||||||
@@ -44,7 +44,10 @@ test.beforeEach(async ({ page }) => {
|
|||||||
json: { newClients: [], activeInPeriodCount: 0, churnRisk: [], churnRiskTotal: 0 },
|
json: { newClients: [], activeInPeriodCount: 0, churnRisk: [], churnRiskTotal: 0 },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// Appointments, clients, services, staff, invoices, book, etc.
|
if (url.includes("/api/invoices")) {
|
||||||
|
return route.fulfill({ json: { data: [], total: 0 } });
|
||||||
|
}
|
||||||
|
// Appointments, clients, services, staff, book, etc.
|
||||||
return route.fulfill({ json: [] });
|
return route.fulfill({ json: [] });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -82,6 +85,7 @@ test("admin staff page loads", async ({ page }) => {
|
|||||||
|
|
||||||
test("admin invoices page loads", async ({ page }) => {
|
test("admin invoices page loads", async ({ page }) => {
|
||||||
await page.goto("/admin/invoices");
|
await page.goto("/admin/invoices");
|
||||||
|
await page.waitForLoadState("domcontentloaded");
|
||||||
await expect(page.getByText("GroomBook")).toBeVisible();
|
await expect(page.getByText("GroomBook")).toBeVisible();
|
||||||
await expect(page.getByRole("link", { name: "Invoices" })).toBeVisible();
|
await expect(page.getByRole("link", { name: "Invoices" })).toBeVisible();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user