diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/PutBit.iml b/.idea/PutBit.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/.idea/PutBit.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..03f397c --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..04b60dd --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/.mvn/wrapper/maven-wrapper.properties b/app/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..d58dfb7 --- /dev/null +++ b/app/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +wrapperVersion=3.3.2 +distributionType=only-script +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip diff --git a/app/data.mv.db b/app/data.mv.db new file mode 100644 index 0000000..1add6d4 Binary files /dev/null and b/app/data.mv.db differ diff --git a/app/src/main/java/putBit/app/models/Exam.java b/app/src/main/java/putBit/app/models/Exam.java index 34e2195..2b601df 100644 --- a/app/src/main/java/putBit/app/models/Exam.java +++ b/app/src/main/java/putBit/app/models/Exam.java @@ -26,4 +26,7 @@ public class Exam { @OneToMany(fetch = FetchType.EAGER, mappedBy = "exam") List users; + + @OneToMany(fetch = FetchType.EAGER, mappedBy = "exam") + List trainings; } diff --git a/app/src/main/java/putBit/app/models/ExamResult.java b/app/src/main/java/putBit/app/models/ExamResult.java index ca90a71..dbcaae3 100644 --- a/app/src/main/java/putBit/app/models/ExamResult.java +++ b/app/src/main/java/putBit/app/models/ExamResult.java @@ -25,7 +25,7 @@ public class ExamResult { @JoinColumn(name = "exam_id", nullable = false) private Exam exam ; - @Column(name = "points", unique = true, nullable = false, length = 3) + @Column(name = "points", nullable = false, length = 3) private int points ; } diff --git a/app/src/main/java/putBit/app/models/Order.java b/app/src/main/java/putBit/app/models/Order.java new file mode 100644 index 0000000..340fa05 --- /dev/null +++ b/app/src/main/java/putBit/app/models/Order.java @@ -0,0 +1,27 @@ +package putBit.app.models; + +import jakarta.persistence.*; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Entity(name = "orders") +public class Order { + + @Id + @OneToOne + @JoinColumn(name = "user_id") + private User user; + + @ManyToOne + @JoinColumn(name = "training_id") + Training training; + + @Column(name = "confirm", columnDefinition = "boolean") + Boolean confirm = false; +} diff --git a/app/src/main/java/putBit/app/models/Training.java b/app/src/main/java/putBit/app/models/Training.java new file mode 100644 index 0000000..8c1c078 --- /dev/null +++ b/app/src/main/java/putBit/app/models/Training.java @@ -0,0 +1,47 @@ +package putBit.app.models; + +import jakarta.persistence.*; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Entity(name = "trainings") +public class Training { + + @Id + @GeneratedValue + @Column(name = "id") + private int id; + + @Column(name = "num", unique = true, nullable = false, length = 50) + private String num ; + + @Column(name = "title", unique = true, nullable = false, length = 50) + private String title ; + + @Column(name = "desc", nullable = false, length = 300) + private String desc ; + + @Column(name = "prof", unique = true, nullable = false, length = 300) + private String prof ; + + @Column(name = "basic_places", nullable = false, length = 3) + private int basic_places ; + + @Column(name = "benefit_places", nullable = false, length = 3) + private int benefit_places ; + + @OneToMany(fetch = FetchType.EAGER, mappedBy = "training") + List exams; + + @OneToMany(fetch = FetchType.EAGER, mappedBy = "training") + List orders; + +} diff --git a/app/src/main/java/putBit/app/models/TrainingExam.java b/app/src/main/java/putBit/app/models/TrainingExam.java new file mode 100644 index 0000000..08ff75e --- /dev/null +++ b/app/src/main/java/putBit/app/models/TrainingExam.java @@ -0,0 +1,32 @@ +package putBit.app.models; + +import jakarta.persistence.*; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Entity(name = "training_exams") +public class TrainingExam { + + @Id + @GeneratedValue + @Column(name = "id") + private int id; + + @ManyToOne + @JoinColumn(name = "training_id", nullable = false) + private Training training ; + + @ManyToOne + @JoinColumn(name = "exam_id", nullable = false) + private Exam exam ; + + @Column(name = "points", nullable = false, length = 3) + private int points ; + +} diff --git a/app/src/main/java/putBit/app/models/User.java b/app/src/main/java/putBit/app/models/User.java index f875042..12df43a 100644 --- a/app/src/main/java/putBit/app/models/User.java +++ b/app/src/main/java/putBit/app/models/User.java @@ -58,4 +58,6 @@ public class User { @OneToMany(fetch = FetchType.EAGER, mappedBy = "user") List exams; + @OneToOne(fetch = FetchType.EAGER, mappedBy = "user" ) + Order order; }