From 7343ee4593f04ff181a8d9dadfd139d2d0ef471e Mon Sep 17 00:00:00 2001 From: Florian Weber <706419+fnwbr@users.noreply.github.com> Date: Tue, 19 Aug 2025 14:43:33 +0000 Subject: [PATCH 1/2] /api/website/: Make name and domain fields optional in POST request schema --- src/app/api/websites/[websiteId]/route.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/api/websites/[websiteId]/route.ts b/src/app/api/websites/[websiteId]/route.ts index 346e5856..4f8763b5 100644 --- a/src/app/api/websites/[websiteId]/route.ts +++ b/src/app/api/websites/[websiteId]/route.ts @@ -31,8 +31,8 @@ export async function POST( { params }: { params: Promise<{ websiteId: string }> }, ) { const schema = z.object({ - name: z.string(), - domain: z.string(), + name: z.string().optional(), + domain: z.string().optional(), shareId: z.string().regex(SHARE_ID_REGEX).nullable().optional(), }); From 49055ebc7d451e6bc672d6ad1614b046e18d925d Mon Sep 17 00:00:00 2001 From: Florian Weber <706419+fnwbr@users.noreply.github.com> Date: Tue, 19 Aug 2025 14:43:42 +0000 Subject: [PATCH 2/2] Add test for updating a website with only shareId --- cypress/e2e/api-website.cy.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/cypress/e2e/api-website.cy.ts b/cypress/e2e/api-website.cy.ts index 7f7d17c3..cd336bda 100644 --- a/cypress/e2e/api-website.cy.ts +++ b/cypress/e2e/api-website.cy.ts @@ -149,6 +149,21 @@ describe('Website API tests', () => { }); }); + it('Updates a website with only shareId.', () => { + cy.request({ + method: 'POST', + url: `/api/websites/${websiteId}`, + headers: { + 'Content-Type': 'application/json', + Authorization: Cypress.env('authorization'), + }, + body: { shareId: 'ABCDEF' }, + }).then(response => { + expect(response.status).to.eq(200); + expect(response.body).to.have.property('shareId', 'ABCDEF'); + }); + }); + it('Resets a website by removing all data related to the website.', () => { cy.request({ method: 'POST',