Skip to content

Commit

Permalink
feat: adding permission column in consumer
Browse files Browse the repository at this point in the history
  • Loading branch information
PedroVidalDev committed Apr 22, 2024
1 parent eb27638 commit a3f49c2
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.pedro.sphynx.application.dtos.consumer;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;

public record ConsumerDataEditInput(@NotBlank String tag){
public record ConsumerDataEditInput(@NotBlank String tag, @NotNull String permission){
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.pedro.sphynx.application.dtos.consumer;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;

public record ConsumerDataInput(
@NotBlank String ra,
@NotBlank String tag){
@NotBlank String tag,
@NotNull int permission){
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public class Consumer {
private Person person;

private String tag;
private int permission;
private LocalDateTime dtcreate;
private LocalDateTime dtupdate;

Expand All @@ -32,5 +33,10 @@ public void actualizeData(ConsumerDataEditInput data) {
this.tag = data.tag();
this.dtupdate = LocalDateTime.now();
}

if(data.permission() != null){
this.tag = data.tag();
this.dtupdate = LocalDateTime.now();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table consumers add permission int;

0 comments on commit a3f49c2

Please sign in to comment.