add boostNotice function

This commit is contained in:
Patryk
2025-05-15 20:29:37 +02:00
parent 3d205df038
commit 1d55f40753
3 changed files with 31 additions and 0 deletions

View File

@@ -106,4 +106,15 @@ public class NoticeController {
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
}
}
@PostMapping("/boost/{id}")
public ResponseEntity boostNotice(@PathVariable("id") long id) {
long clientId = 1L;
if (!noticeService.isNoticeOwnedByClient(id, clientId)) {
throw new EntityNotFoundException("Ogłoszenie nie istnieje lub nie należy do zalogowanego klienta.");
}
noticeService.boostNotice(id);
return ResponseEntity.ok("Ogłoszenie zostało pomyślnie wypromowane.");
}
}