Skip to content

Commit 6b5c18d

Browse files
author
Hattinger04
committed
final version for school
1 parent 5d7256e commit 6b5c18d

File tree

4 files changed

+29
-7
lines changed

4 files changed

+29
-7
lines changed

src/main/java/io/github/Hattinger04/course/model/exercise/Exercise.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ public Exercise(Course course, String name) {
4444
@Column(name = "name", unique = true, nullable = false)
4545
private String name;
4646

47-
@Column(name = "text", unique = false, nullable = true)
48-
private String text;
47+
@Column(name = "hamster", unique = false, nullable = false)
48+
private String hamster;
4949

5050
@ManyToOne
5151
@JoinColumn(name="course_id", nullable = false)

src/main/java/io/github/Hattinger04/course/model/solution/Solution.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,17 @@
3131
@JsonTypeName("solution")
3232
public class Solution {
3333

34-
public Solution(Exercise exercise, String text) {
34+
public Solution(Exercise exercise, String hamster) {
3535
this.exercise = exercise;
36-
this.text = text;
36+
this.hamster = hamster;
3737
}
3838
@Id
3939
@GeneratedValue(strategy = GenerationType.IDENTITY)
4040
@Column(name = "solution_id")
4141
private Integer id;
4242

43-
@Column(name = "text", unique = false, nullable = true)
44-
private String text;
43+
@Column(name = "hamster", unique = false, nullable = false)
44+
private String hamster;
4545

4646
@ManyToOne
4747
@JoinColumn(name="exercise_id", nullable = false)

src/main/java/io/github/Hattinger04/hamster/model/Hamster.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
import javax.persistence.Entity;
44
import javax.persistence.Id;
5+
6+
import com.fasterxml.jackson.annotation.JsonTypeInfo;
7+
import com.fasterxml.jackson.annotation.JsonTypeName;
8+
import com.fasterxml.jackson.annotation.JsonTypeInfo.As;
9+
510
import lombok.AllArgsConstructor;
611
import lombok.Builder;
712
import lombok.Data;
@@ -13,8 +18,15 @@
1318
@AllArgsConstructor
1419
@NoArgsConstructor
1520
@Entity
16-
@ToString
21+
@ToString@JsonTypeInfo(include=As.WRAPPER_OBJECT, use=com.fasterxml.jackson.annotation.JsonTypeInfo.Id.NAME, property="type")
22+
@JsonTypeName("hamster")
1723
public class Hamster {
24+
25+
public Hamster(String program, String programName) {
26+
this.program = program;
27+
this.programName = programName;
28+
}
29+
1830
@Id
1931
private Integer hamster_id;
2032
private String programName;

src/main/resources/allLogs.log

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,3 +354,13 @@ Sep. 03, 2022 11:39:22 AM io.github.Hattinger04.aop.LogAspect loginLog
354354
FEIN: User(id=null, username=admin, password=admin, active=null, roles=null) - [logged in]
355355
Sep. 03, 2022 11:39:57 AM io.github.Hattinger04.aop.LogAspect loginLog
356356
FEIN: User(id=null, username=admin, password=admin, active=null, roles=null) - [logged in]
357+
Okt. 17, 2022 3:15:32 PM io.github.Hattinger04.aop.LogAspect loginLog
358+
FEIN: User(id=null, username=admin, password=admin, active=null, roles=null) - [logged in]
359+
Okt. 17, 2022 3:15:41 PM io.github.Hattinger04.aop.LogAspect loginLog
360+
FEIN: User(id=null, username=admin, password=admin, active=null, roles=null) - [logged in]
361+
Okt. 17, 2022 3:16:15 PM io.github.Hattinger04.aop.LogAspect loginLog
362+
FEIN: User(id=null, username=admin, password=admin, active=null, roles=null) - [logged in]
363+
Okt. 17, 2022 3:22:04 PM io.github.Hattinger04.aop.LogAspect loginLog
364+
FEIN: User(id=null, username=admin, password=admin, active=null, roles=null) - [logged in]
365+
Okt. 17, 2022 3:25:10 PM io.github.Hattinger04.aop.LogAspect loginLog
366+
FEIN: User(id=null, username=admin, password=admin, active=null, roles=null) - [logged in]

0 commit comments

Comments
 (0)