.
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package com.example.controller;
|
||||
|
||||
import com.example.service.base.DataPurgeService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/data-purge")
|
||||
public class DataPurgeController {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(DataPurgeController.class);
|
||||
private final DataPurgeService dataPurgeService;
|
||||
|
||||
public DataPurgeController(DataPurgeService dataPurgeService) {
|
||||
this.dataPurgeService = dataPurgeService;
|
||||
}
|
||||
|
||||
@DeleteMapping("/all")
|
||||
public Mono<Void> purgeAllData() {
|
||||
logger.warn("Received request to purge all data. This is a destructive operation.");
|
||||
return dataPurgeService.purgeAllData()
|
||||
.doOnSuccess(voidResult -> logger.info("Successfully purged all data."))
|
||||
.doOnError(error -> logger.error("Error purging all data.", error));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user