From 0d7dad16dd90bdd35a68fef73ca779dea811d3c6 Mon Sep 17 00:00:00 2001 From: David Montero Crespo Date: Thu, 16 Jul 2026 04:51:24 +0200 Subject: [PATCH] feat(projects): duplicateProject accepts name/description/visibility overrides MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The profile Duplicate dialog passes the chosen name, description and visibility to POST /projects/{id}/duplicate. Options are optional — an empty call still clones with the source name + " (copy)". --- frontend/src/services/projectService.ts | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/frontend/src/services/projectService.ts b/frontend/src/services/projectService.ts index a15f0cb2..767c9d0f 100644 --- a/frontend/src/services/projectService.ts +++ b/frontend/src/services/projectService.ts @@ -103,10 +103,26 @@ export async function deleteProject(id: string): Promise { await api.delete(`/projects/${id}`); } +/** Optional overrides for a duplicate — the Duplicate dialog supplies name / + * description / visibility; omit any field to inherit the source. */ +export interface DuplicateOptions { + name?: string; + description?: string; + is_public?: boolean; + visibility?: ProjectVisibility; +} + /** Clone a project (row + files) into the caller's account. Owners can * duplicate any of their projects; public projects can be duplicated by - * anyone. Returns the freshly created copy. */ -export async function duplicateProject(id: string): Promise { - const { data: result } = await api.post(`/projects/${id}/duplicate`); + * anyone. With no options the copy takes the source name + " (copy)" and + * its visibility. Returns the freshly created copy. */ +export async function duplicateProject( + id: string, + options?: DuplicateOptions, +): Promise { + const { data: result } = await api.post( + `/projects/${id}/duplicate`, + options ?? {}, + ); return result; }