restructured folders and files
This commit is contained in:
@@ -2,5 +2,7 @@ package com.vaessl.app.connection;
|
||||
|
||||
import java.time.Instant;
|
||||
|
||||
import com.vaessl.app.shared.ServiceType;
|
||||
|
||||
public record AuthResponse(ServiceType serviceType, Instant expiresAt) {
|
||||
}
|
||||
|
||||
@@ -19,6 +19,9 @@ import jakarta.servlet.http.HttpSession;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import com.vaessl.app.shared.ServiceType;
|
||||
import com.vaessl.app.shared.SessionKeys;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
public class ConnectionController {
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.vaessl.app.connection;
|
||||
|
||||
import java.time.Instant;
|
||||
|
||||
import com.vaessl.app.shared.ServiceProvider;
|
||||
|
||||
public interface ConnectionProvider extends ServiceProvider {
|
||||
|
||||
void checkCredentials(ConnectionRequest request);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.vaessl.app.connection;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.vaessl.app.shared.ServiceType;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.util.stream.Collectors;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.vaessl.app.exception.WrongServiceTypeException;
|
||||
import com.vaessl.app.shared.ServiceType;
|
||||
|
||||
@Service
|
||||
public class ConnectionService {
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.vaessl.app.connection;
|
||||
|
||||
public enum Endpoint {
|
||||
HOMEBOX_LOGIN("/api/v1/users/login"), LOGIN("/login"), CONNECTION_STATUS(
|
||||
"/connections/status"), HOMEBOX_QUERY_ALL_ITEMS("/api/v1/entities"), SEARCH("/search");
|
||||
|
||||
private final String value;
|
||||
|
||||
private Endpoint(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
@@ -11,8 +11,9 @@ import org.springframework.web.client.RestClient;
|
||||
|
||||
import com.vaessl.app.exception.EmptyCredentialsException;
|
||||
import com.vaessl.app.exception.RemoteApiException;
|
||||
import com.vaessl.app.shared.ServiceType;
|
||||
|
||||
import static com.vaessl.app.connection.Endpoint.*;
|
||||
import static com.vaessl.app.shared.Endpoint.*;
|
||||
|
||||
@Component
|
||||
public class HomeboxConnectionProvider implements ConnectionProvider {
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
package com.vaessl.app.connection;
|
||||
|
||||
public interface ServiceProvider {
|
||||
|
||||
/**
|
||||
* Returns the service type key used to look up this provider in a registry, e.g.
|
||||
* {@code "HOMEBOX"}.
|
||||
*/
|
||||
ServiceType getServiceType();
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package com.vaessl.app.connection;
|
||||
|
||||
public enum ServiceType {
|
||||
HOMEBOX;
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package com.vaessl.app.connection;
|
||||
|
||||
public final class SessionKeys {
|
||||
|
||||
static final String CONNECTION_ID_SUFFIX = "_CONNECTION_ID";
|
||||
|
||||
private SessionKeys() {}
|
||||
|
||||
public static String connectionId(ServiceType serviceType) {
|
||||
return serviceType.name() + CONNECTION_ID_SUFFIX;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user