All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.zodiac.scaff.crud.web.ServiceDeleteController Maven / Gradle / Ivy

package org.zodiac.scaff.crud.web;

import io.swagger.annotations.ApiOperation;
//import io.swagger.v3.oas.annotations.Operation;

import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.zodiac.authorization.api.annotation.Authorize;
import org.zodiac.authorization.api.annotation.DeleteAction;
import org.zodiac.commons.exception.HttpNotFoundException;
import org.zodiac.scaff.crud.service.CrudService;

public interface ServiceDeleteController {

    @Authorize(ignore = true)
    CrudService getService();

    @DeleteMapping("/{id:.+}")
    @DeleteAction
    //@Operation(summary = "Delete according to ID.")
    @ApiOperation(value = "Delete according to ID.")
    default E delete(@PathVariable K id) {
        E data = getService().findById(id).orElseThrow(HttpNotFoundException::new);
        getService().deleteById(id);
        return data;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy