restructured folders and files

This commit is contained in:
2026-06-25 17:17:10 +02:00
parent fb64a7787f
commit 40cbe7103f
22 changed files with 36 additions and 31 deletions
@@ -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 {
@@ -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();
}
@@ -12,11 +12,11 @@ import org.springframework.web.client.RestClient;
import com.vaessl.app.connection.ConnectionEntity;
import com.vaessl.app.connection.ConnectionRepository;
import com.vaessl.app.connection.HomeboxEntity;
import com.vaessl.app.connection.ServiceType;
import com.vaessl.app.exception.ConnectionNotFoundException;
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 HomeboxSearchProvider implements SearchProvider {
@@ -9,7 +9,7 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import com.vaessl.app.connection.SessionKeys;
import com.vaessl.app.shared.SessionKeys;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpSession;
import jakarta.validation.Valid;
@@ -3,7 +3,7 @@ package com.vaessl.app.search;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import com.vaessl.app.connection.ServiceProvider;
import com.vaessl.app.shared.ServiceProvider;
/**
* Implemented by any service that supports querying its remote API for items.
@@ -1,6 +1,6 @@
package com.vaessl.app.search;
import com.vaessl.app.connection.ServiceType;
import com.vaessl.app.shared.ServiceType;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
@@ -7,7 +7,7 @@ import java.util.stream.Collectors;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import com.vaessl.app.connection.ServiceType;
import com.vaessl.app.shared.ServiceType;
import com.vaessl.app.exception.WrongServiceTypeException;
@Service
@@ -1,4 +1,4 @@
package com.vaessl.app.connection;
package com.vaessl.app.shared;
public enum Endpoint {
HOMEBOX_LOGIN("/api/v1/users/login"), LOGIN("/login"), CONNECTION_STATUS(
@@ -0,0 +1,6 @@
package com.vaessl.app.shared;
public interface ServiceProvider {
ServiceType getServiceType();
}
@@ -1,4 +1,4 @@
package com.vaessl.app.connection;
package com.vaessl.app.shared;
public enum ServiceType {
HOMEBOX;
@@ -1,8 +1,8 @@
package com.vaessl.app.connection;
package com.vaessl.app.shared;
public final class SessionKeys {
static final String CONNECTION_ID_SUFFIX = "_CONNECTION_ID";
public static final String CONNECTION_ID_SUFFIX = "_CONNECTION_ID";
private SessionKeys() {}