use better responses
All checks were successful
deploy / deploy (push) Successful in 41s

This commit is contained in:
Lee
2024-04-08 06:48:21 +01:00
parent a2dfd3fc6d
commit 4b4cc8ae54
9 changed files with 57 additions and 55 deletions

View File

@ -0,0 +1,31 @@
package cc.fascinated.model.response;
import io.micrometer.common.lang.NonNull;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.servlet.function.EntityResponse;
@Getter @AllArgsConstructor
public class Response {
/**
* The status code of this error.
*/
private HttpStatus status;
/**
* The message of this error.
*/
private String message;
/**
* Gets this response as a {@link ResponseEntity}.
*
* @return the response entity
*/
public ResponseEntity<?> toResponseEntity() {
return new ResponseEntity<>(this, status);
}
}