-
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.
Create Student entity and repository with role addition in user
- Loading branch information
1 parent
18ca6df
commit 6dedc4c
Showing
3 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
src/main/java/cat/udl/eps/softarch/demo/domain/Student.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,25 @@ | ||
package cat.udl.eps.softarch.demo.domain; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.annotation.JsonValue; | ||
import jakarta.persistence.Entity; | ||
import jakarta.validation.constraints.NotEmpty; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
import org.springframework.security.core.GrantedAuthority; | ||
import org.springframework.security.core.authority.AuthorityUtils; | ||
|
||
import java.util.Collection; | ||
|
||
@Entity | ||
@Data | ||
@EqualsAndHashCode(callSuper = true) | ||
public class Student extends User { | ||
|
||
@NotEmpty | ||
private String phoneNumber; | ||
|
||
@NotEmpty | ||
private String name; | ||
|
||
} |
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
7 changes: 7 additions & 0 deletions
7
src/main/java/cat/udl/eps/softarch/demo/repository/StudentRepository.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,7 @@ | ||
package cat.udl.eps.softarch.demo.repository; | ||
|
||
import cat.udl.eps.softarch.demo.domain.Student; | ||
import org.springframework.data.repository.CrudRepository; | ||
|
||
public interface StudentRepository extends CrudRepository<Student, Long> { | ||
} |