fixes
This commit is contained in:
parent
1521242653
commit
002ca575f2
@ -320,7 +320,7 @@ public class GroupRestAPI {
|
|||||||
return ResponseEntity.status(HttpStatus.FORBIDDEN).build();
|
return ResponseEntity.status(HttpStatus.FORBIDDEN).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
Map map = new Map(mapRequest.name(), mapRequest.image());
|
Map map = new Map(mapRequest.name(), mapRequest.image(), group);
|
||||||
|
|
||||||
mapService.saveMap(map);
|
mapService.saveMap(map);
|
||||||
|
|
||||||
@ -393,7 +393,7 @@ public class GroupRestAPI {
|
|||||||
return ResponseEntity.status(HttpStatus.FORBIDDEN).build();
|
return ResponseEntity.status(HttpStatus.FORBIDDEN).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
Profile profile = new Profile(profileRequest.name(), profileRequest.image());
|
Profile profile = new Profile(profileRequest.name(), profileRequest.image(), group);
|
||||||
|
|
||||||
profileService.saveProfile(profile);
|
profileService.saveProfile(profile);
|
||||||
|
|
||||||
@ -557,7 +557,7 @@ public class GroupRestAPI {
|
|||||||
return ResponseEntity.badRequest().build();
|
return ResponseEntity.badRequest().build();
|
||||||
}
|
}
|
||||||
|
|
||||||
Profile profile = new Profile(profileRequest.name(), profileRequest.image());
|
Profile profile = new Profile(profileRequest.name(), profileRequest.image(), group);
|
||||||
|
|
||||||
profileService.saveProfile(profile);
|
profileService.saveProfile(profile);
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ import jakarta.validation.constraints.NotBlank;
|
|||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
|
|
||||||
public record GroupRequest(
|
public record GroupRequest(
|
||||||
@Size(max = 50, message = "{title longer than 50 chars}")
|
@Size(max = 50, message = "{name can not be longer than 50 chars}")
|
||||||
@NotBlank String name) {
|
@NotBlank String name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,5 +4,5 @@ import jakarta.validation.constraints.NotBlank;
|
|||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
|
|
||||||
public record LineupRequest(
|
public record LineupRequest(
|
||||||
@Size(max = 50, message = "{name longer than 50 chars}") @NotBlank String description,
|
@Size(max = 512, message = "{description can not be longer than 512 chars}") @NotBlank String description,
|
||||||
byte[] image) {}
|
byte[] image) {}
|
||||||
|
@ -4,5 +4,5 @@ import jakarta.validation.constraints.NotBlank;
|
|||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
|
|
||||||
public record MapRequest(
|
public record MapRequest(
|
||||||
@Size(max = 50, message = "{name longer than 50 chars}") @NotBlank String name,
|
@Size(max = 50, message = "{name can not be longer than 50 chars}") @NotBlank String name,
|
||||||
byte[] image) {}
|
byte[] image) {}
|
||||||
|
@ -3,6 +3,6 @@ package me.akito123321.valoStrats.rest.requests;
|
|||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
|
|
||||||
public record PlayerTypeRequest(@Size(max = 50, message = "{title longer than 50 chars}") @NotBlank String name,
|
public record PlayerTypeRequest(@Size(max = 50, message = "{name can not be longer than 50 chars}") @NotBlank String name,
|
||||||
@Size(max = 50, message = "{title longer than 50 chars}") @NotBlank String task) {
|
@Size(max = 512, message = "{task can not be longer than 512 chars}") @NotBlank String task) {
|
||||||
}
|
}
|
||||||
|
@ -8,9 +8,9 @@ import jakarta.validation.constraints.Size;
|
|||||||
import me.akito123321.valoStrats.schemas.StratState;
|
import me.akito123321.valoStrats.schemas.StratState;
|
||||||
|
|
||||||
public record StratRequest(
|
public record StratRequest(
|
||||||
@Size(max = 50, message = "{title longer than 50 chars}") @NotBlank String title,
|
@Size(max = 50, message = "{title can not be longer than 50 chars}") @NotBlank String title,
|
||||||
@Size(max = 512, message = "{title longer than 50 chars}") @NotBlank String description,
|
@Size(max = 512, message = "{description can not be longer than 50 chars}") @NotBlank String description,
|
||||||
@Size(max = 50, message = "{title longer than 50 chars}") @NotBlank String stratType,
|
@Size(max = 50, message = "{title stratType can not be than 50 chars}") @NotBlank String stratType,
|
||||||
@NotNull List<StratState> stratStates,
|
@NotNull List<StratState> stratStates,
|
||||||
Integer attempts,
|
Integer attempts,
|
||||||
Integer success) {
|
Integer success) {
|
||||||
|
@ -4,6 +4,6 @@ import jakarta.validation.constraints.NotBlank;
|
|||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
|
|
||||||
public record StratStateRequest (
|
public record StratStateRequest (
|
||||||
@Size(max = 512, message = "{title longer than 50 chars}") @NotBlank String description,
|
@Size(max = 512, message = "{description can not be longer than 512 chars}") @NotBlank String description,
|
||||||
byte[] image) {
|
byte[] image) {
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
package me.akito123321.valoStrats.schemas;
|
package me.akito123321.valoStrats.schemas;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import jakarta.persistence.CascadeType;
|
||||||
import jakarta.persistence.ElementCollection;
|
import jakarta.persistence.ElementCollection;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.FetchType;
|
import jakarta.persistence.FetchType;
|
||||||
@ -13,7 +16,7 @@ import jakarta.persistence.ManyToMany;
|
|||||||
import jakarta.persistence.ManyToOne;
|
import jakarta.persistence.ManyToOne;
|
||||||
import jakarta.persistence.OneToMany;
|
import jakarta.persistence.OneToMany;
|
||||||
|
|
||||||
@Entity(name = "wishlist_group")
|
@Entity(name = "strats_group")
|
||||||
public class Group {
|
public class Group {
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.UUID)
|
@GeneratedValue(strategy = GenerationType.UUID)
|
||||||
@ -22,27 +25,22 @@ public class Group {
|
|||||||
@ManyToOne
|
@ManyToOne
|
||||||
private StratsUser owner;
|
private StratsUser owner;
|
||||||
@ManyToMany(fetch = FetchType.EAGER)
|
@ManyToMany(fetch = FetchType.EAGER)
|
||||||
private List<StratsUser> members;
|
private List<StratsUser> members = new ArrayList<StratsUser>();
|
||||||
@OneToMany(fetch = FetchType.EAGER)
|
@OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL, mappedBy = "group")
|
||||||
private List<Strat> strats;
|
private List<Strat> strats = new ArrayList<Strat>();
|
||||||
|
|
||||||
@OneToMany(fetch = FetchType.EAGER)
|
@OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL, mappedBy = "group")
|
||||||
private List<Map> maps;
|
private List<Map> maps = new ArrayList<Map>();
|
||||||
|
|
||||||
@ManyToMany(fetch = FetchType.EAGER)
|
@OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL, mappedBy = "group")
|
||||||
private List<Profile> profiles;
|
private List<Profile> profiles = new ArrayList<Profile>();
|
||||||
|
|
||||||
@ElementCollection(fetch = FetchType.EAGER)
|
@ElementCollection(fetch = FetchType.EAGER)
|
||||||
private List<String> stratTypes;
|
private Set<String> stratTypes = new HashSet<String>();
|
||||||
|
|
||||||
public Group(String name, StratsUser owner) {
|
public Group(String name, StratsUser owner) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
this.members = new ArrayList<StratsUser>();
|
|
||||||
this.strats = new ArrayList<Strat>();
|
|
||||||
this.maps = new ArrayList<Map>();
|
|
||||||
this.profiles = new ArrayList<Profile>();
|
|
||||||
this.stratTypes = new ArrayList<String>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Group() {
|
public Group() {
|
||||||
@ -73,7 +71,7 @@ public class Group {
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getStratTypes() {
|
public Set<String> getStratTypes() {
|
||||||
return stratTypes;
|
return stratTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,10 @@ public class Lineup {
|
|||||||
this.lineupImage = lineupImage;
|
this.lineupImage = lineupImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Lineup() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import jakarta.persistence.GeneratedValue;
|
|||||||
import jakarta.persistence.GenerationType;
|
import jakarta.persistence.GenerationType;
|
||||||
import jakarta.persistence.Id;
|
import jakarta.persistence.Id;
|
||||||
import jakarta.persistence.Lob;
|
import jakarta.persistence.Lob;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
public class Map {
|
public class Map {
|
||||||
@ -15,14 +16,22 @@ public class Map {
|
|||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
private Group group;
|
||||||
|
|
||||||
@Lob
|
@Lob
|
||||||
@Column(length = Integer.MAX_VALUE)
|
@Column(length = Integer.MAX_VALUE)
|
||||||
private byte[] image;
|
private byte[] image;
|
||||||
|
|
||||||
public Map(String name, byte[] image) {
|
public Map(String name, byte[] image, Group group) {
|
||||||
super();
|
super();
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.image = image;
|
this.image = image;
|
||||||
|
this.group = group;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
@ -3,6 +3,7 @@ package me.akito123321.valoStrats.schemas;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import jakarta.persistence.CascadeType;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.FetchType;
|
import jakarta.persistence.FetchType;
|
||||||
import jakarta.persistence.GeneratedValue;
|
import jakarta.persistence.GeneratedValue;
|
||||||
@ -20,7 +21,7 @@ public class PlayerType {
|
|||||||
|
|
||||||
private String task;
|
private String task;
|
||||||
|
|
||||||
@ManyToMany(fetch = FetchType.EAGER)
|
@ManyToMany(fetch = FetchType.EAGER, cascade = CascadeType.DETACH)
|
||||||
private List<Profile> profiles;
|
private List<Profile> profiles;
|
||||||
|
|
||||||
public PlayerType(String name, String task) {
|
public PlayerType(String name, String task) {
|
||||||
|
@ -6,6 +6,7 @@ import jakarta.persistence.GeneratedValue;
|
|||||||
import jakarta.persistence.GenerationType;
|
import jakarta.persistence.GenerationType;
|
||||||
import jakarta.persistence.Id;
|
import jakarta.persistence.Id;
|
||||||
import jakarta.persistence.Lob;
|
import jakarta.persistence.Lob;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
public class Profile {
|
public class Profile {
|
||||||
@ -14,6 +15,9 @@ public class Profile {
|
|||||||
private String id;
|
private String id;
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
private Group group;
|
||||||
|
|
||||||
@Lob
|
@Lob
|
||||||
@Column(length = Integer.MAX_VALUE)
|
@Column(length = Integer.MAX_VALUE)
|
||||||
private byte[] image;
|
private byte[] image;
|
||||||
@ -22,10 +26,11 @@ public class Profile {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Profile(String name, byte[] image) {
|
public Profile(String name, byte[] image, Group group) {
|
||||||
super();
|
super();
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.image = image;
|
this.image = image;
|
||||||
|
this.group = group;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
@ -26,10 +26,10 @@ public class Strat {
|
|||||||
private Group group;
|
private Group group;
|
||||||
|
|
||||||
@ElementCollection(fetch = FetchType.EAGER)
|
@ElementCollection(fetch = FetchType.EAGER)
|
||||||
private List<StratState> stratStates;
|
private List<StratState> stratStates = new ArrayList<StratState>();
|
||||||
|
|
||||||
@OneToMany(fetch = FetchType.EAGER)
|
@OneToMany(fetch = FetchType.EAGER)
|
||||||
private List<PlayerType> playerTypes;
|
private List<PlayerType> playerTypes = new ArrayList<PlayerType>();
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
private Map map;
|
private Map map;
|
||||||
@ -39,8 +39,6 @@ public class Strat {
|
|||||||
this.description = description;
|
this.description = description;
|
||||||
this.group = group;
|
this.group = group;
|
||||||
this.stratType = stratType;
|
this.stratType = stratType;
|
||||||
this.stratStates = new ArrayList<StratState>();
|
|
||||||
this.playerTypes = new ArrayList<PlayerType>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Strat() {
|
public Strat() {
|
||||||
|
Loading…
Reference in New Issue
Block a user