Checkpoint - added many to many user group relations and test cerating users and groups to accept test
This commit is contained in:
@ -1,13 +1,18 @@
|
||||
package com.plannaplan.entities;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.ManyToMany;
|
||||
|
||||
import com.plannaplan.models.UserApiResponse;
|
||||
import com.plannaplan.types.UserRoles;
|
||||
@ -33,6 +38,20 @@ public class User {
|
||||
private String refreshToken;
|
||||
private Timestamp tokenUsageDate;
|
||||
private Integer ranking;
|
||||
@ManyToMany(cascade = CascadeType.ALL)
|
||||
@JoinTable
|
||||
private Set<Groups> studentRegisteredGrups;
|
||||
|
||||
public Set<Groups> getStudentRegisteredGrups() {
|
||||
return this.studentRegisteredGrups;
|
||||
}
|
||||
|
||||
public void claimGroup(Groups group) {
|
||||
if (this.studentRegisteredGrups == null) {
|
||||
this.studentRegisteredGrups = new HashSet<>();
|
||||
}
|
||||
this.studentRegisteredGrups.add(group);
|
||||
}
|
||||
|
||||
public User() {
|
||||
}
|
||||
|
Reference in New Issue
Block a user