Skip to content

Commit

Permalink
:feat past fields to unicorn
Browse files Browse the repository at this point in the history
  • Loading branch information
leandrofpk committed Jul 12, 2022
1 parent 8943d63 commit 8acc384
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
@@ -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;
}

}
Original file line number Diff line number Diff line change
@@ -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 + '\'' +
'}';
}
}

0 comments on commit 8acc384

Please sign in to comment.