Entities
This commit is contained in:
1 parent
2419085684
commit
e9c0383024
7 files changed
+165
-7
No files matched your search
@@ -0,0 +1,2 @@
|
|||||||
|
/mvnw text eol=lf
|
||||||
|
*.cmd text eol=crlf
|
||||||
+33
@@ -0,0 +1,33 @@
|
|||||||
|
HELP.md
|
||||||
|
target/
|
||||||
|
.mvn/wrapper/maven-wrapper.jar
|
||||||
|
!**/src/main/**/target/
|
||||||
|
!**/src/test/**/target/
|
||||||
|
|
||||||
|
### STS ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
build/
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
||||||
@@ -14,13 +14,13 @@ public class CodeController {
|
|||||||
private final TourCodeService tourCodeService;
|
private final TourCodeService tourCodeService;
|
||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
public String greeting(@RequestParam(defaultValue = "ABCDEFGHI") String code) {
|
public String test(@RequestParam(defaultValue = "ABCDEFGHI") String code) {
|
||||||
TourCode t = tourCodeService.getTourCodeByCode(code);
|
TourCode t = tourCodeService.getTourCodeByCode(code);
|
||||||
if (t == null) {
|
if (t == null) {
|
||||||
t = tourCodeService.addTourCode(code);
|
t = tourCodeService.addTourCode(code);
|
||||||
return "Created TC " + String.valueOf(t.id);
|
return "Created TC " + t.getId();
|
||||||
}
|
}
|
||||||
return "Hello " + t.code + "(" + String.valueOf(t.activated) + ")";
|
return "Hello " + t.getCode() + "(" + t.getActivated() + ") " + t.getCreationTimestamp();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package de.exodus_hn.excalibur_tour.entities;
|
||||||
|
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
@Entity
|
||||||
|
@Table(name = "riddles")
|
||||||
|
public class Riddle {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Column(nullable = false)
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Column(nullable = false)
|
||||||
|
private Integer step;
|
||||||
|
|
||||||
|
@Column(nullable = false)
|
||||||
|
private Double latitude;
|
||||||
|
|
||||||
|
@Column(nullable = false)
|
||||||
|
private Double longitude;
|
||||||
|
|
||||||
|
@Column(nullable = false)
|
||||||
|
private Integer points;
|
||||||
|
|
||||||
|
@Column(nullable = false)
|
||||||
|
private Integer failPenaltyPoints;
|
||||||
|
|
||||||
|
@Column(nullable = false)
|
||||||
|
private Integer skipPenaltyPoints;
|
||||||
|
|
||||||
|
@OneToMany(mappedBy = "riddle", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||||
|
@Builder.Default
|
||||||
|
private List<RiddleHint> hints = new ArrayList<>();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package de.exodus_hn.excalibur_tour.entities;
|
||||||
|
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
@Entity
|
||||||
|
@Table(name = "riddle_hints")
|
||||||
|
public class RiddleHint {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Column(nullable = false)
|
||||||
|
private String hint;
|
||||||
|
|
||||||
|
@Column(nullable = false)
|
||||||
|
private Integer penaltyPoints;
|
||||||
|
|
||||||
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
|
@JoinColumn(name = "riddle_id", nullable = false)
|
||||||
|
private Riddle riddle;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -13,15 +13,15 @@ import java.time.LocalDateTime;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Builder
|
@Builder
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "TourCodes")
|
@Table(name = "tour_codes")
|
||||||
public class TourCode {
|
public class TourCode {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
public Long id;
|
private Long id;
|
||||||
|
|
||||||
@Column(nullable = false, unique = true)
|
@Column(nullable = false, unique = true)
|
||||||
public String code;
|
private String code;
|
||||||
|
|
||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
private LocalDateTime creationTimestamp;
|
private LocalDateTime creationTimestamp;
|
||||||
@@ -34,7 +34,10 @@ public class TourCode {
|
|||||||
|
|
||||||
@Builder.Default
|
@Builder.Default
|
||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
public Boolean activated = true;
|
private Boolean activated = true;
|
||||||
|
|
||||||
|
@OneToOne(mappedBy = "tourCode", cascade = CascadeType.ALL, orphanRemoval = false)
|
||||||
|
private TourSession tourSession;
|
||||||
|
|
||||||
public TourCode(String code) {
|
public TourCode(String code) {
|
||||||
this.code = code;
|
this.code = code;
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package de.exodus_hn.excalibur_tour.entities;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
import lombok.*;
|
||||||
|
import org.hibernate.annotations.JdbcTypeCode;
|
||||||
|
import org.hibernate.type.SqlTypes;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
//@Builder
|
||||||
|
@Entity
|
||||||
|
@Table(name = "tour_sessions")
|
||||||
|
public class TourSession {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@OneToOne(fetch = FetchType.EAGER)
|
||||||
|
@JoinColumn(name = "tour_code_id")
|
||||||
|
private TourCode tourCode;
|
||||||
|
|
||||||
|
@Lob
|
||||||
|
@Column(name = "data", columnDefinition = "text")
|
||||||
|
private String data;
|
||||||
|
|
||||||
|
|
||||||
|
/*@JdbcTypeCode(SqlTypes.JSON)
|
||||||
|
@Column(name = "data", columnDefinition = "jsonb")
|
||||||
|
private JsonNode data;*/
|
||||||
|
|
||||||
|
/*@JdbcTypeCode(SqlTypes.JSON)
|
||||||
|
@Column(name = "players", columnDefinition = "jsonb")
|
||||||
|
@Builder.Default
|
||||||
|
private List<Player> players = new ArrayList<>();
|
||||||
|
|
||||||
|
@Column(nullable = false)
|
||||||
|
private Integer points;*/
|
||||||
|
}
|
||||||
Reference in new issue
Block a user