diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/user/UserAttributesDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/user/UserAttributesDto.java index 48f9662ef87771f0d770ac82c1d46fc5e03964e8..69a40539e3d90ee33665b133ceee204f6e984fac 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/user/UserAttributesDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/user/UserAttributesDto.java @@ -3,9 +3,10 @@ package at.tuwien.api.user; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.v3.oas.annotations.media.Schema; -import jakarta.validation.constraints.NotNull; import lombok.*; import lombok.extern.jackson.Jacksonized; +import org.springframework.data.elasticsearch.annotations.Field; +import org.springframework.data.elasticsearch.annotations.FieldType; @Getter @Setter @@ -16,14 +17,17 @@ import lombok.extern.jackson.Jacksonized; @ToString public class UserAttributesDto { - @NotNull + @JsonIgnore + @org.springframework.data.annotation.Transient @JsonProperty("theme_dark") @Schema(example = "false") private Boolean themeDark; + @Field(name = "orcid", type = FieldType.Keyword) @Schema(example = "https://orcid.org/0000-0002-1825-0097") private String orcid; + @Field(name = "affiliation", type = FieldType.Keyword) @Schema(example = "Brown University") private String affiliation; diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/user/UserDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/user/UserDto.java index de30923fd9a250897295f66e38c025cc1146b4b5..2796dcba78eda06384c96bd901c25215ac64f609 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/user/UserDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/user/UserDto.java @@ -51,6 +51,7 @@ public class UserDto { private String lastname; @NotNull + @Field(name = "attributes", includeInParent = true, type = FieldType.Nested) private UserAttributesDto attributes; @NotNull diff --git a/dbrepo-search-sync-agent/rest-service/src/test/java/at/tuwien/config/IndexConfigComponentTest.java b/dbrepo-search-sync-agent/rest-service/src/test/java/at/tuwien/config/IndexConfigComponentTest.java index e6de4dba38399dfa5259b3e0738d8f2b79f870b9..a9680a954e16570278a71d4cd6f9dada4aef98f0 100644 --- a/dbrepo-search-sync-agent/rest-service/src/test/java/at/tuwien/config/IndexConfigComponentTest.java +++ b/dbrepo-search-sync-agent/rest-service/src/test/java/at/tuwien/config/IndexConfigComponentTest.java @@ -29,7 +29,6 @@ import java.util.Map; import static org.junit.jupiter.api.Assertions.*; - @Log4j2 @Testcontainers @SpringBootTest @@ -272,15 +271,10 @@ public class IndexConfigComponentTest extends BaseUnitTest { assertEquals("keyword", types.get("id")); assertEquals("keyword", types.get("username")); assertEquals("keyword", types.get("name")); - assertEquals("keyword", types.get("orcid")); assertEquals("keyword", types.get("firstname")); assertEquals("keyword", types.get("lastname")); - assertNull(types.get("attributes")); - assertNull(types.get("containers")); - assertNull(types.get("databases")); - assertNull(types.get("identifiers")); + assertEquals("nested", types.get("attributes")); assertNull(types.get("email")); - assertNull(types.get("email_verified")); } private Map<String, String> getTypes(String indexName, GetMappingsResponse data) {