-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
VKT(Backend): good and satisfactory level enrollment core functionality
- Loading branch information
Showing
9 changed files
with
253 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
backend/vkt/src/main/java/fi/oph/vkt/model/EnrollmentAppointment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
package fi.oph.vkt.model; | ||
|
||
import fi.oph.vkt.model.type.EnrollmentStatus; | ||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.EnumType; | ||
import jakarta.persistence.Enumerated; | ||
import jakarta.persistence.FetchType; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.JoinColumn; | ||
import jakarta.persistence.ManyToOne; | ||
import jakarta.persistence.OneToMany; | ||
import jakarta.persistence.OneToOne; | ||
import jakarta.persistence.Table; | ||
import jakarta.validation.constraints.Size; | ||
import java.time.LocalDateTime; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
@Getter | ||
@Setter | ||
@Entity | ||
@Table(name = "enrollment") | ||
public class EnrollmentAppointment extends BaseEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "enrollment_appointment_id", nullable = false) | ||
private long id; | ||
|
||
@Column(name = "skill_oral") | ||
private boolean oralSkill; | ||
|
||
@Column(name = "skill_textual") | ||
private boolean textualSkill; | ||
|
||
@Column(name = "skill_understanding") | ||
private boolean understandingSkill; | ||
|
||
@Column(name = "partial_exam_speaking") | ||
private boolean speakingPartialExam; | ||
|
||
@Column(name = "partial_exam_speech_comprehension") | ||
private boolean speechComprehensionPartialExam; | ||
|
||
@Column(name = "partial_exam_writing") | ||
private boolean writingPartialExam; | ||
|
||
@Column(name = "partial_exam_reading_comprehension") | ||
private boolean readingComprehensionPartialExam; | ||
|
||
@Column(name = "digital_certificate_consent") | ||
private boolean digitalCertificateConsent; | ||
|
||
@Column(name = "email") | ||
private String email; | ||
|
||
@Column(name = "phone_number") | ||
private String phoneNumber; | ||
|
||
@Column(name = "street") | ||
private String street; | ||
|
||
@Column(name = "postal_code") | ||
private String postalCode; | ||
|
||
@Column(name = "town") | ||
private String town; | ||
|
||
@Column(name = "country") | ||
private String country; | ||
|
||
@Size(max = 255) | ||
@Column(name = "auth_hash", unique = true) | ||
private String authHash; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "person_id", referencedColumnName = "person_id") | ||
private Person person; | ||
|
||
@OneToMany(mappedBy = "enrollmentAppointment") | ||
private List<Payment> payments = new ArrayList<>(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
backend/vkt/src/main/java/fi/oph/vkt/repository/EnrollmentAppointmentRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package fi.oph.vkt.repository; | ||
|
||
import fi.oph.vkt.api.dto.FreeEnrollmentDetails; | ||
import fi.oph.vkt.model.Enrollment; | ||
import fi.oph.vkt.model.EnrollmentAppointment; | ||
import fi.oph.vkt.model.ExamEvent; | ||
import fi.oph.vkt.model.Person; | ||
import fi.oph.vkt.model.type.EnrollmentStatus; | ||
import java.util.List; | ||
import java.util.Optional; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface EnrollmentAppointmentRepository extends BaseRepository<EnrollmentAppointment> { | ||
Optional<EnrollmentAppointment> findByIdAndAuthHash(final long id, final String paymentLinkHash); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
backend/vkt/src/main/java/fi/oph/vkt/service/PublicEnrollmentAppointmentService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package fi.oph.vkt.service; | ||
|
||
import fi.oph.vkt.api.dto.FreeEnrollmentAttachmentDTO; | ||
import fi.oph.vkt.api.dto.FreeEnrollmentDetails; | ||
import fi.oph.vkt.api.dto.FreeEnrollmentDetailsDTO; | ||
import fi.oph.vkt.api.dto.PublicEducationDTO; | ||
import fi.oph.vkt.api.dto.PublicEnrollmentCreateDTO; | ||
import fi.oph.vkt.api.dto.PublicEnrollmentDTO; | ||
import fi.oph.vkt.api.dto.PublicEnrollmentInitialisationDTO; | ||
import fi.oph.vkt.api.dto.PublicExamEventDTO; | ||
import fi.oph.vkt.api.dto.PublicFreeEnrollmentBasisDTO; | ||
import fi.oph.vkt.api.dto.PublicPersonDTO; | ||
import fi.oph.vkt.api.dto.PublicReservationDTO; | ||
import fi.oph.vkt.model.Enrollment; | ||
import fi.oph.vkt.model.EnrollmentAppointment; | ||
import fi.oph.vkt.model.ExamEvent; | ||
import fi.oph.vkt.model.FeatureFlag; | ||
import fi.oph.vkt.model.FreeEnrollment; | ||
import fi.oph.vkt.model.Person; | ||
import fi.oph.vkt.model.Reservation; | ||
import fi.oph.vkt.model.UploadedFileAttachment; | ||
import fi.oph.vkt.model.type.EnrollmentStatus; | ||
import fi.oph.vkt.model.type.FreeEnrollmentSource; | ||
import fi.oph.vkt.model.type.FreeEnrollmentType; | ||
import fi.oph.vkt.repository.EnrollmentAppointmentRepository; | ||
import fi.oph.vkt.repository.EnrollmentRepository; | ||
import fi.oph.vkt.repository.ExamEventRepository; | ||
import fi.oph.vkt.repository.FreeEnrollmentRepository; | ||
import fi.oph.vkt.repository.ReservationRepository; | ||
import fi.oph.vkt.repository.UploadedFileAttachmentRepository; | ||
import fi.oph.vkt.service.aws.S3Service; | ||
import fi.oph.vkt.service.koski.KoskiService; | ||
import fi.oph.vkt.util.EnrollmentUtil; | ||
import fi.oph.vkt.util.ExamEventUtil; | ||
import fi.oph.vkt.util.PersonUtil; | ||
import fi.oph.vkt.util.exception.APIException; | ||
import fi.oph.vkt.util.exception.APIExceptionType; | ||
import fi.oph.vkt.util.exception.NotFoundException; | ||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Optional; | ||
import java.util.stream.Collectors; | ||
import lombok.RequiredArgsConstructor; | ||
import org.apache.commons.io.FilenameUtils; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class PublicEnrollmentAppointmentService extends AbstractEnrollmentService { | ||
|
||
private final EnrollmentAppointmentRepository enrollmentAppointmentRepository; | ||
|
||
public EnrollmentAppointment getEnrollmentAppointmentByHash( | ||
final long enrollmentAppointmentId, | ||
final String authHash | ||
) { | ||
return enrollmentAppointmentRepository.findByIdAndAuthHash(enrollmentAppointmentId, authHash).orElseThrow(); | ||
} | ||
|
||
public void savePersonInfo(long targetId, Person person) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters