Files
int-layer/src.bak/main/java/com/example/controller/DataPurgeController.java
2026-02-20 08:42:45 +00:00

30 lines
1.1 KiB
Java

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));
}
}