Skip to content
Snippets Groups Projects
Commit fb23854f authored by Ester Vilímková's avatar Ester Vilímková
Browse files

Merge branch 'M2' into 'main'

M2

See merge request !31
parents 3dbf1750 7f46a9f6
No related branches found
No related tags found
1 merge request!31M2
Pipeline #
Showing
with 210 additions and 149 deletions
......@@ -11,14 +11,37 @@
- Martin Gargalovič *@xgargal*
- Jan Pokorný *@xpokorn8*
- Ester Vilímková - _Project Leader_ *@xvilimk*
- **Assigment**:
- Create a system for language school lecture management. Each lecture can occur on a given day and time and is related to some course. The course is defined by its (unique) name, language and proficiency level. However, each lecture will be independent. That means that each lecture can have a different topic. Different lecturers can give it, and an arbitrary number of students can enrol. Each lecturer will have a name, surname, and record of taught languages. In addition, the lecturer will indicate that they are a native speaker. Exercises can be prepared for each course to allow the students to learn the language. Each student can pick the exercises depending on the levels of difficulty.
- **Running the modules**:
- ```cd ./application```
- ```mvn clean install```
- ```cd ./module-*```
- ```mvn spring-boot:run```
- **Running the modules using docker-compose**:
```console
cd ./application
mvn clean install
docker-compose build --parallel
docker-compose up
```
- **Running the modules using podman-compose**:
~~~console
cd ./application
mvn clean install
podman-compose build --parallel
podman-compose up
~~~
- **Running the modules using docker**:
~~~console
sudo docker run -d -p 5001:5001 xpokorn8/sprachschulsystem:certificate &&
sudo docker run -d -p 5002:5002 xpokorn8/sprachschulsystem:exercise &&
sudo docker run -d -p 5000:5000 xpokorn8/sprachschulsystem:language-school &&
sudo docker run -d -p 5003:5003 xpokorn8/sprachschulsystem:mail
~~~
# Project Description
......
version: '3'
services:
certificate:
build: ./module-certificate
container_name: certificate
image: xpokorn8/sprachschulsystem:certificate
ports:
- "5001:5001"
exercise:
build: ./module-exercise
container_name: exercise
image: xpokorn8/sprachschulsystem:exercise
ports:
- "5002:5002"
language-school:
build: ./module-language-school
container_name: language-school
image: xpokorn8/sprachschulsystem:language-school
ports:
- "5000:5000"
mail:
build: ./module-mail
container_name: mail
image: xpokorn8/sprachschulsystem:mail
ports:
- "5003:5003"
\ No newline at end of file
......@@ -33,6 +33,6 @@ public class CertificateDto extends DomainObjectDto {
private CertificateFileDto certificateFile;
public CertificateDto() {
setId("0");
setId(0L);
}
}
package org.fuseri.model.dto.certificate;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
import org.fuseri.model.dto.common.DomainObjectDto;
import java.time.Instant;
/**
* This class represents a Data Transfer Object (DTO) for Certificate entities.
* It is used to transfer Certificate data between different layers of the application.
* It extends the DomainObjectDto class and includes additional Certificate-specific fields.
*/
@Getter
@Setter
public class CertificateSimpleDto extends DomainObjectDto {
@NotBlank
@NotNull
private Long userId;
@NotBlank
@NotNull
private Instant generatedAt;
@NotBlank
@NotNull
private Long courseId;
@NotBlank
@NotNull
private String certificateFile;
@NotBlank
@NotNull
private String certificateFileName;
public CertificateSimpleDto(Long id, Long userId, Instant generatedAt, Long courseId, String certificateFile, String certificateFileName) {
this.setId(id);
this.userId = userId;
this.generatedAt = generatedAt;
this.courseId = courseId;
this.certificateFile = certificateFile;
this.certificateFileName = certificateFileName;
}
}
package org.fuseri.model.dto.common;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@EqualsAndHashCode(exclude = "id")
public abstract class DomainObjectDto {
@NotBlank
@NotNull
private String id;
private Long id;
}
package org.fuseri.model.dto.common;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
@Getter
@Setter
public class Result<T extends DomainObjectDto> {
private long total;
private int page;
private int pageSize;
private List<T> items;
}
......@@ -6,6 +6,7 @@ import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
......@@ -16,6 +17,7 @@ import lombok.Setter;
@Getter
@Setter
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
public class CourseCreateDto {
@NotBlank(message = "Course name is required")
......@@ -28,10 +30,10 @@ public class CourseCreateDto {
@NotNull(message = "Language type is required")
@Valid
private LanguageTypeDto languageTypeDto;
private LanguageTypeDto language;
@NotNull(message = "Proficiency level is required")
@Valid
private ProficiencyLevelDto proficiencyLevelDto;
private ProficiencyLevelDto proficiency;
}
......@@ -9,6 +9,7 @@ import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import org.fuseri.model.dto.common.DomainObjectDto;
import org.fuseri.model.dto.user.UserDto;
import java.util.ArrayList;
import java.util.List;
......@@ -20,7 +21,7 @@ import java.util.List;
*/
@Getter
@Setter
@EqualsAndHashCode
@EqualsAndHashCode(callSuper = false)
public class CourseDto extends DomainObjectDto {
@NotBlank(message = "Course name is required")
......@@ -33,22 +34,22 @@ public class CourseDto extends DomainObjectDto {
@NotNull(message = "Language type is required")
@Valid
private LanguageTypeDto languageTypeDto;
private LanguageTypeDto language;
@NotNull(message = "Proficiency level is required")
@Valid
private ProficiencyLevelDto proficiencyLevelDto;
private ProficiencyLevelDto proficiency;
@NotNull(message = "Student's list is required")
@Valid
private List<String> studentIds;
private List<UserDto> students;
public CourseDto(String name, Integer capacity, LanguageTypeDto languageTypeDto, ProficiencyLevelDto proficiencyLevelDto) {
setId("0");
this.name = name;
this.capacity = capacity;
this.languageTypeDto = languageTypeDto;
this.proficiencyLevelDto = proficiencyLevelDto;
this.studentIds = new ArrayList<>();
this.language = languageTypeDto;
this.proficiency = proficiencyLevelDto;
this.students = new ArrayList<>();
}
}
package org.fuseri.model.dto.course;
/**
* An enum representing language proficiency levels based on the CEFR standard.
*/
public enum ProficiencyLevelDto {
A1,
A2,
B1,
B2,
C1,
C2,
C1N,
C2N
}
A1("Beginner"),
A2("Elementary"),
B1("Intermediate"),
B2("Upper Intermediate"),
C1("Advanced"),
C2("Proficient"),
C1N("Advanced Native speaker"),
C2N("Proficient Native speaker");
private final String description;
/**
* Constructor for LanguageLevel enum.
*
* @param description a String representing a brief description of the language proficiency level
*/
ProficiencyLevelDto(String description) {
this.description = description;
}
/**
* Returns a brief description of the language proficiency level.
*
* @return a String representing the description of the language proficiency level
*/
public String getDescription() {
return description;
}
}
\ No newline at end of file
......@@ -15,6 +15,6 @@ public class AnswerCreateDto {
@NotNull
private boolean correct;
@NotBlank
private String questionId;
@NotNull
private long questionId;
}
......@@ -3,13 +3,13 @@ package org.fuseri.model.dto.exercise;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import org.fuseri.model.dto.common.DomainObjectDto;
import java.util.Objects;
@AllArgsConstructor
@Getter
@EqualsAndHashCode(callSuper = false)
public class AnswerDto extends DomainObjectDto {
@NotBlank
......@@ -17,22 +17,4 @@ public class AnswerDto extends DomainObjectDto {
@NotNull
private boolean correct;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
AnswerDto answerDto = (AnswerDto) o;
if (correct != answerDto.correct) return false;
return Objects.equals(text, answerDto.text);
}
@Override
public int hashCode() {
int result = text != null ? text.hashCode() : 0;
result = 31 * result + (correct ? 1 : 0);
return result;
}
}
package org.fuseri.model.dto.exercise;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Getter;
......@@ -11,8 +11,8 @@ import java.util.List;
@Getter
public class AnswersCreateDto {
@NotBlank
private String questionId;
@NotNull
private long questionId;
@Valid
private List<AnswerInQuestionCreateDto> answers;
......
......@@ -9,7 +9,6 @@ import lombok.Getter;
@AllArgsConstructor
@Getter
public class ExerciseCreateDto {
@NotBlank
private String name;
......@@ -20,6 +19,6 @@ public class ExerciseCreateDto {
@PositiveOrZero
private int difficulty;
@NotBlank
private String courseId;
@NotNull
private long courseId;
}
......@@ -3,14 +3,14 @@ package org.fuseri.model.dto.exercise;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.PositiveOrZero;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import org.fuseri.model.dto.common.DomainObjectDto;
import java.util.Objects;
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public class ExerciseDto extends DomainObjectDto {
@NotBlank
......@@ -23,28 +23,6 @@ public class ExerciseDto extends DomainObjectDto {
@PositiveOrZero
private int difficulty;
@NotBlank
private String courseId;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ExerciseDto that = (ExerciseDto) o;
if (difficulty != that.difficulty) return false;
if (!Objects.equals(name, that.name)) return false;
if (!Objects.equals(description, that.description)) return false;
return Objects.equals(courseId, that.courseId);
}
@Override
public int hashCode() {
int result = name != null ? name.hashCode() : 0;
result = 31 * result + (description != null ? description.hashCode() : 0);
result = 31 * result + difficulty;
result = 31 * result + (courseId != null ? courseId.hashCode() : 0);
return result;
}
@NotNull
private long courseId;
}
......@@ -2,6 +2,7 @@ package org.fuseri.model.dto.exercise;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Getter;
......@@ -14,8 +15,8 @@ public class QuestionCreateDto {
@NotBlank
private String text;
@NotBlank
private String exerciseId;
@NotNull
private long exerciseId;
@Valid
private List<AnswerInQuestionCreateDto> answers;
......
......@@ -2,43 +2,29 @@ package org.fuseri.model.dto.exercise;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.fuseri.model.dto.common.DomainObjectDto;
import java.util.List;
import java.util.Objects;
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
public class QuestionDto extends DomainObjectDto {
@NotBlank
private String text;
@NotBlank
private String exerciseId;
@NotNull
private long exerciseId;
@Valid
private List<AnswerDto> answers;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
QuestionDto that = (QuestionDto) o;
if (!Objects.equals(text, that.text)) return false;
if (!Objects.equals(exerciseId, that.exerciseId)) return false;
return Objects.equals(answers, that.answers);
}
@Override
public int hashCode() {
int result = text != null ? text.hashCode() : 0;
result = 31 * result + (exerciseId != null ? exerciseId.hashCode() : 0);
result = 31 * result + (answers != null ? answers.hashCode() : 0);
return result;
}
}
package org.fuseri.model.dto.exercise;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Builder;
import lombok.Getter;
......@@ -11,6 +12,6 @@ public class QuestionUpdateDto {
@NotBlank
private String text;
@NotBlank
private String exerciseId;
@NotNull
private long exerciseId;
}
......@@ -3,7 +3,6 @@ package org.fuseri.model.dto.lecture;
import jakarta.validation.constraints.*;
import lombok.Getter;
import lombok.Setter;
import org.fuseri.model.dto.course.CourseDto;
import java.time.LocalDateTime;
......@@ -13,11 +12,11 @@ public class LectureCreateDto {
@Future(message = "Lecture start date and time must be in the future")
@NotNull(message = "Lecture start date and time cannot be null")
private LocalDateTime from;
private LocalDateTime lectureFrom;
@Future(message = "Lecture end date and time must be in the future")
@NotNull(message = "Lecture end date and time cannot be null")
private LocalDateTime to;
private LocalDateTime lectureTo;
@NotBlank(message = "Lecture topic cannot be blank")
@Size(max = 255, message = "Lecture topic must be no more than {max} characters")
......@@ -27,12 +26,12 @@ public class LectureCreateDto {
@Min(value = 1, message = "Lecture capacity must be at least 1")
private Integer capacity;
@NotBlank(message = "Lecture course cannot be blank")
private String courseId;
@NotNull(message = "Lecture course cannot be null")
private Long courseId;
public LectureCreateDto(LocalDateTime from, LocalDateTime to, String topic, Integer capacity, String courseId) {
this.from = from;
this.to = to;
public LectureCreateDto(LocalDateTime from, LocalDateTime to, String topic, Integer capacity, Long courseId) {
this.lectureFrom = from;
this.lectureTo = to;
this.topic = topic;
this.capacity = capacity;
this.courseId = courseId;
......@@ -40,7 +39,7 @@ public class LectureCreateDto {
@AssertTrue(message = "Lecture start datetime must be before Lecture end datetime")
private boolean isFromDateBeforeToDate() {
if (from == null || to == null) return true;
return from.isBefore(to);
if (lectureFrom == null || lectureTo == null) return true;
return lectureFrom.isBefore(lectureTo);
}
}
package org.fuseri.model.dto.lecture;
import jakarta.validation.constraints.*;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import org.fuseri.model.dto.common.DomainObjectDto;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public class LectureDto extends DomainObjectDto {
@Future(message = "Lecture start date and time must be in the future")
@NotNull(message = "Lecture start date and time cannot be null")
private LocalDateTime from;
private LocalDateTime lectureFrom;
@Future(message = "Lecture end date and time must be in the future")
@NotNull(message = "Lecture end date and time cannot be null")
private LocalDateTime to;
private LocalDateTime lectureTo;
@NotBlank(message = "Lecture topic cannot be blank")
@Size(max = 255, message = "Lecture topic must be no more than {max} characters")
......@@ -29,28 +30,28 @@ public class LectureDto extends DomainObjectDto {
@Min(value = 1, message = "Lecture capacity must be at least 1")
private Integer capacity;
@NotNull(message = "Lecture capacity cannot be null")
private String lecturerId;
@NotNull(message = "Lecture lecturer cannot be null")
private Long lecturerId;
@NotBlank(message = "Lecture courseId cannot be blank")
private String courseId;
@NotNull(message = "Lecture courseId cannot be null")
private Long courseId;
@NotNull(message = "Student IDs list cannot be null")
private List<String> studentIds;
private List<Long> students;
public LectureDto(LocalDateTime from, LocalDateTime to, String topic, Integer capacity, String lecturerId, String courseId) {
this.from = from;
this.to = to;
public LectureDto(LocalDateTime from, LocalDateTime to, String topic, Integer capacity, Long lecturerId, Long courseId, List<Long> students) {
this.lectureFrom = from;
this.lectureTo = to;
this.topic = topic;
this.capacity = capacity;
this.lecturerId = lecturerId;
this.courseId = courseId;
this.studentIds = new ArrayList<>();
this.students = students;
}
@AssertTrue(message = "Lecture start datetime must be before Lecture end datetime")
private boolean isFromDateBeforeToDate() {
if (from == null || to == null) return true;
return from.isBefore(to);
if (lectureFrom == null || lectureTo == null) return true;
return lectureFrom.isBefore(lectureTo);
}
}
......@@ -2,6 +2,7 @@ package org.fuseri.model.dto.user;
import jakarta.validation.constraints.NotBlank;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
......@@ -10,15 +11,21 @@ import lombok.Setter;
@Setter
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode
public class AddressDto {
@NotBlank
private String country;
@NotBlank
private String city;
@NotBlank
private String street;
@NotBlank
private String houseNumber;
@NotBlank
private String zip;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment