feature/implement-external-login-api #30

Merged
kasun merged 32 commits from feature/implement-external-login-api into main 2026-04-09 21:21:58 +02:00
3 changed files with 31 additions and 20 deletions
Showing only changes of commit 8b1a604dc2 - Show all commits
@@ -0,0 +1,16 @@
package com.vaessl.app.connection;
public enum Endpoint {
HOMEBOX_LOGIN("/api/v1/users/login"), LOGIN("/login");
private final String value;
private Endpoint(String value) {
this.value = value;
}
public String getValue() {
return value;
}
}
@@ -1,14 +0,0 @@
package com.vaessl.app.connection;
import lombok.Getter;
@Getter
public enum Endpoints {
HOMEBOX_LOGIN("/api/v1/users/login");
private final String endpoint;
Endpoints(String endpoint){
this.endpoint = endpoint;
}
}
@@ -2,25 +2,34 @@ package com.vaessl.app.exception;
import org.springframework.http.HttpStatus;
import lombok.Getter;
import com.fasterxml.jackson.annotation.JsonValue;
@Getter
public enum ErrorMessages {
public enum ErrorMessage {
BAD_REQUEST_EMPTY_FIELDS(HttpStatus.BAD_REQUEST, "Fields must not be empty."), UNAUTHORIZED_WRONG_LOGIN(
HttpStatus.UNAUTHORIZED, "Invalid username or password."), SERVICE_UNAVAILABLE_UNREACHABLE_URL(
HttpStatus.SERVICE_UNAVAILABLE, "The target URL is unreachable."), SERVER_ERROR_GENERAL(
"The external app returned a server error: ");
"The external app returned a server error: "), WRONG_SERVICE_TYPE(HttpStatus.BAD_REQUEST,
"No such service type.");
private final HttpStatus status;
private final String message;
ErrorMessages(HttpStatus status, String message) {
private ErrorMessage(HttpStatus status, String message) {
this.status = status;
this.message = message;
}
ErrorMessages(String message) {
private ErrorMessage(String message) {
this.status = null;
this.message = message;
}
public HttpStatus getStatus() {
return status;
}
@JsonValue
public String getMessage() {
return message;
}
}