Openstatus www.openstatus.dev

fix issue (#1798)

authored by

Thibault Le Ouay and committed by
GitHub
4244aeae c0f52eae

+6 -6
+5 -5
apps/server/src/routes/rpc/services/status-report/__tests__/status-report.test.ts
··· 447 447 .where(eq(statusReport.id, Number(data.statusReport.id))); 448 448 }); 449 449 450 - test("sets pageId to null when no components provided", async () => { 450 + test("preserves pageId when no components provided", async () => { 451 451 const res = await connectRequest( 452 452 "CreateStatusReport", 453 453 { 454 454 title: `${TEST_PREFIX}-null-pageid`, 455 455 status: "STATUS_REPORT_STATUS_INVESTIGATING", 456 - message: "Test null pageId when no components.", 456 + message: "Test pageId preserved when no components.", 457 457 date: new Date().toISOString(), 458 - pageId: "1", // This should be ignored 458 + pageId: "1", 459 459 pageComponentIds: [], 460 460 }, 461 461 { "x-openstatus-key": "1" }, ··· 466 466 const data = await res.json(); 467 467 expect(data).toHaveProperty("statusReport"); 468 468 469 - // Verify the pageId is null 469 + // Verify the pageId is preserved from the request 470 470 const createdReport = await db 471 471 .select() 472 472 .from(statusReport) 473 473 .where(eq(statusReport.id, Number(data.statusReport.id))) 474 474 .get(); 475 - expect(createdReport?.pageId).toBeNull(); 475 + expect(createdReport?.pageId).toBe(1); 476 476 477 477 // Clean up 478 478 await db
+1 -1
apps/server/src/routes/rpc/services/status-report/index.ts
··· 297 297 } 298 298 299 299 // Use the derived pageId from components (null if no components) 300 - const pageId = derivedPageId; 300 + const pageId = Number(providedPageId); 301 301 302 302 // Create the status report 303 303 const report = await tx