diff --git a/beacon-engine/src/main/resources/db/migration/V2.11__create_table_list_value_unicorn.sql b/beacon-engine/src/main/resources/db/migration/V2.11__create_table_list_value_unicorn.sql new file mode 100644 index 0000000..7276c89 --- /dev/null +++ b/beacon-engine/src/main/resources/db/migration/V2.11__create_table_list_value_unicorn.sql @@ -0,0 +1,16 @@ +CREATE TABLE list_value_unicorn ( + id bigint(20) NOT NULL AUTO_INCREMENT, + type varchar(255) DEFAULT NULL, + uri varchar(255) DEFAULT NULL, + value varchar(255) DEFAULT NULL, + pulse_id bigint(20) DEFAULT NULL, + PRIMARY KEY (id), + KEY FK_list_value_unicorn (pulse_id) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +ALTER TABLE list_value_unicorn +ADD CONSTRAINT fk_list_value_unicorn_1 + FOREIGN KEY (pulse_id) + REFERENCES vdf_unicorn (id) + ON DELETE NO ACTION + ON UPDATE NO ACTION; \ No newline at end of file diff --git a/beacon-interface/src/main/java/com/example/beacon/interfac/infra/ListValueUnicornEntity.java b/beacon-interface/src/main/java/com/example/beacon/interfac/infra/ListValueUnicornEntity.java new file mode 100644 index 0000000..ac17190 --- /dev/null +++ b/beacon-interface/src/main/java/com/example/beacon/interfac/infra/ListValueUnicornEntity.java @@ -0,0 +1,36 @@ +package com.example.beacon.interfac.infra; + +import lombok.Data; + +import javax.persistence.*; + +@Data +@Entity +@Table(name = "list_value_unicorn") +public class ListValueUnicornEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + private String value; + + private String type; + + private String uri; + + @ManyToOne + @JoinColumn(name = "pulse_id") + private PulseEntity pulseEntity; + + public ListValueUnicornEntity() { + } + + public ListValueUnicornEntity(String value, String type, String uri, PulseEntity pulseEntity) { + this.value = value; + this.type = type; + this.uri = uri; + this.pulseEntity = pulseEntity; + } + +} diff --git a/beacon-interface/src/test/java/com/example/beacon/shared/ListValue.java b/beacon-interface/src/test/java/com/example/beacon/shared/ListValue.java new file mode 100644 index 0000000..6742f17 --- /dev/null +++ b/beacon-interface/src/test/java/com/example/beacon/shared/ListValue.java @@ -0,0 +1,36 @@ +package com.example.beacon.shared; + +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.NonNull; + +//@Getter +@Data +@NoArgsConstructor +public class ListValue { + + private String uri; + + private String type; + + private String value; + + private ListValue(@NonNull String value, @NonNull String type, String uri) { + this.value = value; + this.type = type; + this.uri = uri; + } + + public static ListValue getOneValue(String value, String type, String uri){ + return new ListValue(value, type, uri); + } + + @Override + public String toString() { + return "ListValue{" + + "value='" + value + '\'' + + ", type='" + type + '\'' + + ", uri='" + uri + '\'' + + '}'; + } +}