Skip to content

Commit

Permalink
feat: adding name column in consumer entity
Browse files Browse the repository at this point in the history
  • Loading branch information
PedroVidalDev committed Jun 3, 2024
1 parent a2ae431 commit 5dd67de
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import com.pedro.sphynx.infrastructure.entities.Consumer;
import com.pedro.sphynx.infrastructure.entities.Permission;

public record ConsumerDataComplete (Long id, String ra, String tag, PermissionDataComplete permission){
public record ConsumerDataComplete (Long id, String name, String ra, String tag, PermissionDataComplete permission){

public ConsumerDataComplete(Consumer consumer){
this(consumer.getId(), consumer.getRa(), consumer.getTag(), new PermissionDataComplete(consumer.getPermission()));
this(consumer.getId(), consumer.getName(), consumer.getRa(), consumer.getTag(), new PermissionDataComplete(consumer.getPermission()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import jakarta.validation.constraints.NotNull;

public record ConsumerDataInput(
@NotBlank String name,
@NotBlank String ra,
@NotBlank String tag,
@NotNull int permission){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class Consumer {
@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

private String name;
private String ra;
private String tag;

Expand All @@ -32,6 +33,7 @@ public class Consumer {

public Consumer(ConsumerDataInput data, Permission permission){
this.id = null;
this.name = data.name();
this.ra = data.ra();
this.tag = data.tag();
this.permission = permission;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
create table if not exists consumers(
id bigint not null auto_increment,
name varchar(255) not null,
ra varchar(255) not null,
tag varchar(255) not null,

Expand Down

0 comments on commit 5dd67de

Please sign in to comment.