feat: add private product management endpoints for updating canonical names and merging products
Test Suite / test (24.15.0) (push) Has been cancelled

This commit is contained in:
Nils-Johan Gynther
2026-05-09 23:19:28 +02:00
parent 8e276a34fe
commit 14a1107466
4 changed files with 134 additions and 34 deletions
@@ -140,6 +140,26 @@ export class ProductsController {
return this.productsService.createPending(body, req.user.id);
}
// ── Privata produkter: rename & merge ──────────────────────────────────────
// Inloggade användare kan hantera sina egna privata produkter
@Patch('private/:id/canonical-name')
updateCanonicalNamePrivate(
@Param('id', ParseIntPipe) id: number,
@Body() body: UpdateCanonicalNameDto,
@Request() req: { user: { id: number } },
) {
return this.productsService.updateCanonicalNamePrivate(req.user.id, id, body.canonicalName);
}
@Post('private/merge')
mergePrivate(
@Body() body: MergeProductsDto,
@Request() req: { user: { id: number } },
) {
return this.productsService.mergePrivate(req.user.id, body.sourceProductId, body.targetProductId);
}
@Roles('admin')
@Post('merge')
merge(@Body() body: MergeProductsDto) {