diff --git a/src/main/java/cat/udl/eps/softarch/demo/domain/Permission.java b/src/main/java/cat/udl/eps/softarch/demo/domain/Permission.java index b1fc8ff..6c535a1 100644 --- a/src/main/java/cat/udl/eps/softarch/demo/domain/Permission.java +++ b/src/main/java/cat/udl/eps/softarch/demo/domain/Permission.java @@ -4,21 +4,33 @@ import jakarta.persistence.GeneratedValue; import jakarta.persistence.GenerationType; import jakarta.persistence.Id; +import jakarta.persistence.ManyToMany; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; import lombok.Data; import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; + +import java.util.Set; @Entity +@Setter +@Getter @Data @EqualsAndHashCode(callSuper = false) public class Permission { @Id + @NotNull @GeneratedValue(strategy = GenerationType.AUTO) private Long id; - @NotNull @NotBlank private String name; + + @NotNull + @ManyToMany + private Set role; + } diff --git a/src/main/java/cat/udl/eps/softarch/demo/repository/PermissionRepository.java b/src/main/java/cat/udl/eps/softarch/demo/repository/PermissionRepository.java new file mode 100644 index 0000000..2ce912c --- /dev/null +++ b/src/main/java/cat/udl/eps/softarch/demo/repository/PermissionRepository.java @@ -0,0 +1,8 @@ +package cat.udl.eps.softarch.demo.repository; + +import cat.udl.eps.softarch.demo.domain.Permission; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.PagingAndSortingRepository; + +public interface PermissionRepository extends CrudRepository, PagingAndSortingRepository { +}