feat(products): include ownerId in product creation and enforce its requirement

This commit is contained in:
Nils-Johan Gynther
2026-05-02 19:12:26 +02:00
parent 4e568b4d2e
commit 5842646e77
3 changed files with 15 additions and 10 deletions
+2 -2
View File
@@ -128,8 +128,8 @@ export class ProductsController {
@Roles('admin')
@Post()
create(@Body() body: CreateProductDto) {
return this.productsService.create(body);
create(@Body() body: CreateProductDto, @Request() req: { user: { id: number } }) {
return this.productsService.create(body, req.user.id);
}
// Tillgänglig för alla inloggade användare — req.user.id injiceras av JWT-guard