fix: OIDC auth flow, Vite proxy, and PostgreSQL query compat
- Add auth redirect in root layout for unauthenticated users - Proxy OIDC routes (/login, /callback, /logout) through Vite dev server - Strip Secure flag from OIDC cookies in dev mode (HTTP localhost) - Disable retry on auth query to prevent stale cookie loops - Fix SQLite .get()/.all()/.run() calls in category and global-item services for PostgreSQL compatibility - Add userId scoping to category service functions - Add OIDC error logging in auth middleware - Apply linter auto-formatting across affected files Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -43,13 +43,8 @@ process.env.S3_BUCKET = "gearbox-images";
|
||||
process.env.S3_REGION = "us-east-1";
|
||||
|
||||
// Import after mocking
|
||||
const {
|
||||
uploadImage,
|
||||
deleteImage,
|
||||
getImageUrl,
|
||||
withImageUrl,
|
||||
withImageUrls,
|
||||
} = await import("@/server/services/storage.service");
|
||||
const { uploadImage, deleteImage, getImageUrl, withImageUrl, withImageUrls } =
|
||||
await import("@/server/services/storage.service");
|
||||
|
||||
describe("storage.service", () => {
|
||||
beforeEach(() => {
|
||||
@@ -66,7 +61,9 @@ describe("storage.service", () => {
|
||||
await uploadImage(buffer, "test-image.jpg", "image/jpeg");
|
||||
|
||||
expect(mockSend).toHaveBeenCalledTimes(1);
|
||||
const command = mockSend.mock.calls[0][0] as { input: Record<string, unknown> };
|
||||
const command = mockSend.mock.calls[0][0] as {
|
||||
input: Record<string, unknown>;
|
||||
};
|
||||
expect(command.input.Bucket).toBe("gearbox-images");
|
||||
expect(command.input.Key).toBe("test-image.jpg");
|
||||
expect(command.input.ContentType).toBe("image/jpeg");
|
||||
@@ -78,7 +75,9 @@ describe("storage.service", () => {
|
||||
await uploadImage(arrayBuffer, "test.png", "image/png");
|
||||
|
||||
expect(mockSend).toHaveBeenCalledTimes(1);
|
||||
const command = mockSend.mock.calls[0][0] as { input: Record<string, unknown> };
|
||||
const command = mockSend.mock.calls[0][0] as {
|
||||
input: Record<string, unknown>;
|
||||
};
|
||||
expect(Buffer.isBuffer(command.input.Body)).toBe(true);
|
||||
});
|
||||
});
|
||||
@@ -88,7 +87,9 @@ describe("storage.service", () => {
|
||||
await deleteImage("test-image.jpg");
|
||||
|
||||
expect(mockSend).toHaveBeenCalledTimes(1);
|
||||
const command = mockSend.mock.calls[0][0] as { input: Record<string, unknown> };
|
||||
const command = mockSend.mock.calls[0][0] as {
|
||||
input: Record<string, unknown>;
|
||||
};
|
||||
expect(command.input.Bucket).toBe("gearbox-images");
|
||||
expect(command.input.Key).toBe("test-image.jpg");
|
||||
});
|
||||
@@ -99,9 +100,7 @@ describe("storage.service", () => {
|
||||
const url = await getImageUrl("test-image.jpg");
|
||||
|
||||
expect(mockGetSignedUrl).toHaveBeenCalledTimes(1);
|
||||
expect(url).toBe(
|
||||
"https://minio:9000/gearbox-images/test.jpg?signed=1",
|
||||
);
|
||||
expect(url).toBe("https://minio:9000/gearbox-images/test.jpg?signed=1");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user