-
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.
Merge pull request #48 from UdL-EPS-SoftArch/main
Merge main to feat/category
- Loading branch information
Showing
18 changed files
with
368 additions
and
1 deletion.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
src/main/java/cat/udl/eps/softarch/tfgfinder/domain/Admin.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,22 @@ | ||
package cat.udl.eps.softarch.tfgfinder.domain; | ||
import jakarta.persistence.ElementCollection; | ||
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 Admin extends User{ | ||
|
||
@Override | ||
@ElementCollection | ||
public Collection<GrantedAuthority> getAuthorities() { | ||
return AuthorityUtils.commaSeparatedStringToAuthorityList("ROLE_ADMIN"); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/main/java/cat/udl/eps/softarch/tfgfinder/domain/Agree.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,34 @@ | ||
package cat.udl.eps.softarch.tfgfinder.domain; | ||
|
||
import jakarta.persistence.*; | ||
import jakarta.validation.constraints.NotBlank; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
import org.springframework.format.annotation.DateTimeFormat; | ||
|
||
import java.time.ZonedDateTime; | ||
import java.util.Collection; | ||
|
||
@Entity | ||
@Table(name = "agrees") | ||
@Data | ||
@EqualsAndHashCode(callSuper = true) | ||
public class Agree extends UriEntity<Long> { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@DateTimeFormat | ||
private ZonedDateTime when; | ||
|
||
public enum Status { | ||
PENDING, | ||
ACCEPTED, | ||
REJECTED | ||
} | ||
|
||
@Enumerated(EnumType.STRING) | ||
private Status status; | ||
|
||
} |
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
28 changes: 28 additions & 0 deletions
28
src/main/java/cat/udl/eps/softarch/tfgfinder/domain/Director.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,28 @@ | ||
package cat.udl.eps.softarch.tfgfinder.domain; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.annotation.JsonValue; | ||
import jakarta.persistence.ElementCollection; | ||
import jakarta.persistence.Entity; | ||
import jakarta.validation.constraints.*; | ||
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 Director extends User { | ||
|
||
@NotNull(message = "Availability cannot be null") | ||
private Boolean available = true; | ||
|
||
@Override | ||
@ElementCollection | ||
public Collection<GrantedAuthority> getAuthorities() { | ||
return AuthorityUtils.createAuthorityList("ROLE_DIRECTOR"); | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
src/main/java/cat/udl/eps/softarch/tfgfinder/domain/External.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,57 @@ | ||
package cat.udl.eps.softarch.tfgfinder.domain; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.annotation.JsonValue; | ||
import jakarta.persistence.ElementCollection; | ||
import jakarta.persistence.Entity; | ||
import jakarta.validation.constraints.*; | ||
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 External extends Director { | ||
|
||
@NotEmpty | ||
@Size(min = 2, max = 50, message = "The first name must be between 2 and 50 characters") | ||
private String name; | ||
|
||
@NotEmpty | ||
@Size(min = 2, max = 50, message = "The last name must be between 2 and 50 characters") | ||
private String surname; | ||
|
||
@NotEmpty | ||
@Size(min = 2, max = 100, message = "The position must be between 2 and 100 characters") | ||
private String position; | ||
|
||
@NotEmpty | ||
@Size(min = 2, max = 100, message = "The organization must be between 2 and 100 characters") | ||
private String organization; | ||
|
||
@NotEmpty | ||
@Size(min = 5, max = 100, message = "The address must be between 5 and 100 characters") | ||
private String address; | ||
|
||
@NotEmpty | ||
@Size(min = 2, max = 50, message = "The municipality must be between 2 and 50 characters") | ||
private String municipality; | ||
|
||
@NotEmpty | ||
@Pattern(regexp = "^[0-9]{5}$", message = "The postal code must contain exactly 5 digits") | ||
private String postalCode; | ||
|
||
@NotEmpty | ||
@Pattern(regexp = "^[0-9]{9}$", message = "The phone number must contain exactly 9 digits") | ||
private String phoneNumber; | ||
|
||
@Override | ||
@ElementCollection | ||
public Collection<GrantedAuthority> getAuthorities() { | ||
return AuthorityUtils.createAuthorityList("ROLE_EXTERNAL"); | ||
} | ||
} |
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
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 |
---|---|---|
|
@@ -27,4 +27,7 @@ public class Message extends UriEntity<Long> { | |
@ManyToOne | ||
private User from; | ||
|
||
@ManyToOne | ||
private Chat chat; | ||
|
||
} |
41 changes: 41 additions & 0 deletions
41
src/main/java/cat/udl/eps/softarch/tfgfinder/domain/Professor.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,41 @@ | ||
package cat.udl.eps.softarch.tfgfinder.domain; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.annotation.JsonValue; | ||
import jakarta.persistence.ElementCollection; | ||
import jakarta.persistence.Entity; | ||
import jakarta.validation.constraints.*; | ||
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 Professor extends Director { | ||
|
||
@NotEmpty | ||
@Size(min = 2, max = 100, message = "The faculty name must be between 2 and 100 characters") | ||
private String faculty; | ||
|
||
@NotEmpty | ||
@Size(min = 2, max = 100, message = "The department name must be between 2 and 100 characters") | ||
private String department; | ||
|
||
@NotEmpty | ||
@Size(min = 2, max = 50, message = "The first name must be between 2 and 50 characters") | ||
private String name; | ||
|
||
@NotEmpty | ||
@Size(min = 2, max = 50, message = "The last name must be between 2 and 50 characters") | ||
private String surname; | ||
|
||
@Override | ||
@ElementCollection | ||
public Collection<GrantedAuthority> getAuthorities() { | ||
return AuthorityUtils.createAuthorityList("ROLE_PROFESSOR"); | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
src/main/java/cat/udl/eps/softarch/tfgfinder/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,57 @@ | ||
package cat.udl.eps.softarch.tfgfinder.domain; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.annotation.JsonValue; | ||
import jakarta.persistence.ElementCollection; | ||
import jakarta.persistence.Entity; | ||
import jakarta.validation.constraints.*; | ||
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 | ||
@Size(min = 2, max = 50, message = "The name must be between 2 and 50 characters long") | ||
private String name; | ||
|
||
@NotEmpty | ||
@Size(min = 2, max = 50, message = "The surname must be between 2 and 50 characters long") | ||
private String surname; | ||
|
||
@NotEmpty | ||
@Pattern(regexp = "^[0-9]{8}[A-Za-z]$", message = "The DNI must have 8 digits followed by a letter") | ||
private String DNI; | ||
|
||
@NotEmpty | ||
@Size(min = 5, max = 100, message = "The address must be between 5 and 100 characters long") | ||
private String address; | ||
|
||
@NotEmpty | ||
@Size(min = 2, max = 50, message = "The municipality must be between 2 and 50 characters long") | ||
private String municipality; | ||
|
||
@NotEmpty | ||
@Pattern(regexp = "^[0-9]{5}$", message = "The postal code must contain exactly 5 digits") | ||
private String postalCode; | ||
|
||
@NotEmpty | ||
@Pattern(regexp = "^[0-9]{9}$", message = "The phone number must contain exactly 9 digits") | ||
private String phoneNumber; | ||
|
||
@NotEmpty | ||
@Size(min = 2, max = 100, message = "The degree name must be between 2 and 100 characters long") | ||
private String degree; | ||
|
||
@Override | ||
@ElementCollection | ||
public Collection<GrantedAuthority> getAuthorities() { | ||
return AuthorityUtils.commaSeparatedStringToAuthorityList("ROLE_STUDENT"); | ||
} | ||
} |
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
15 changes: 15 additions & 0 deletions
15
src/main/java/cat/udl/eps/softarch/tfgfinder/repository/AdminRepository.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,15 @@ | ||
package cat.udl.eps.softarch.tfgfinder.repository; | ||
|
||
import cat.udl.eps.softarch.tfgfinder.domain.Admin; | ||
import cat.udl.eps.softarch.tfgfinder.domain.User; | ||
import org.springframework.data.repository.CrudRepository; | ||
import org.springframework.data.repository.PagingAndSortingRepository; | ||
import org.springframework.data.repository.query.Param; | ||
import org.springframework.data.rest.core.annotation.RepositoryRestResource; | ||
|
||
import java.util.List; | ||
|
||
@RepositoryRestResource | ||
public interface AdminRepository extends CrudRepository<Admin, String>, PagingAndSortingRepository<Admin, String> { | ||
List<User> findByIdContaining(@Param("text") String text); | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/cat/udl/eps/softarch/tfgfinder/repository/ChatRepository.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,13 @@ | ||
package cat.udl.eps.softarch.tfgfinder.repository; | ||
|
||
import cat.udl.eps.softarch.tfgfinder.domain.Message; | ||
import org.springframework.data.repository.CrudRepository; | ||
import org.springframework.data.repository.PagingAndSortingRepository; | ||
import org.springframework.data.rest.core.annotation.RepositoryRestResource; | ||
|
||
@RepositoryRestResource | ||
public interface ChatRepository extends CrudRepository<Message, Long>, PagingAndSortingRepository<Message, Long> { | ||
|
||
|
||
|
||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/cat/udl/eps/softarch/tfgfinder/repository/DirectorRepository.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,14 @@ | ||
package cat.udl.eps.softarch.tfgfinder.repository; | ||
|
||
import cat.udl.eps.softarch.tfgfinder.domain.Director; | ||
import org.springframework.data.repository.CrudRepository; | ||
import org.springframework.data.repository.PagingAndSortingRepository; | ||
import org.springframework.data.repository.query.Param; | ||
import org.springframework.data.rest.core.annotation.RepositoryRestResource; | ||
|
||
import java.util.List; | ||
|
||
@RepositoryRestResource | ||
public interface DirectorRepository extends CrudRepository<Director, String>, PagingAndSortingRepository<Director, String> { | ||
List<Director> findByAvailable(@Param("available") Boolean available); | ||
} |
Oops, something went wrong.