Forráskód Böngészése

refactor: change update method from PUT to POST in AdsController and simplify ID validation

Dave 1 hónapja
szülő
commit
fc3b7f3cb4

+ 6 - 6
apps/box-mgnt-api/src/mgnt-backend/feature/ads/ads.controller.ts

@@ -68,18 +68,18 @@ export class AdsController {
     return this.service.create(dto);
   }
 
-  @Put(':id')
+  @Post()
   @ApiOperation({
     summary:
       'Update an ad (adType updates honored, legacy adsModuleId is resolved)',
   })
   @ApiBody({ type: UpdateAdsDto })
   @ApiResponse({ status: 200, type: AdsDto })
-  update(@Param() { id }: MongoIdParamDto, @Body() dto: UpdateAdsDto) {
-    if (dto.id && dto.id !== id) {
-      throw new BadRequestException('ID in body must match ID in path');
-    }
-    return this.service.update({ ...dto, id });
+  update(@Body() dto: UpdateAdsDto) {
+    // if (dto.id && dto.id !== id) {
+    //   throw new BadRequestException('ID in body must match ID in path');
+    // }
+    return this.service.update(dto);
   }
 
   @Delete(':id')