forked from buttasam/cms-boot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
74 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package app.persistence.entity; | ||
|
||
import javax.persistence.*; | ||
|
||
/** | ||
* @author Samuel Butta | ||
*/ | ||
@Entity | ||
public class Role { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.AUTO) | ||
private Long id; | ||
|
||
@Column(unique = true) | ||
@Enumerated(EnumType.STRING) | ||
private RoleType role; | ||
|
||
public Long getId() { | ||
return id; | ||
} | ||
|
||
public void setId(Long id) { | ||
this.id = id; | ||
} | ||
|
||
public RoleType getRole() { | ||
return role; | ||
} | ||
|
||
public void setRole(RoleType role) { | ||
this.role = role; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package app.persistence.entity; | ||
|
||
/** | ||
* Prehled uzivatelskych roli v cele aplikaci. | ||
* | ||
* @author Samuel Butta | ||
*/ | ||
public enum RoleType { | ||
|
||
USER, | ||
ADMIN | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/main/java/app/persistence/repository/RoleRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package app.persistence.repository; | ||
|
||
import app.persistence.entity.Role; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
/** | ||
* @author Samuel Butta | ||
*/ | ||
@Repository | ||
public interface RoleRepository extends JpaRepository<Role, Long> { | ||
} |