-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from bcgov/feature/EAC-20
Changes to support history - EAC-20
- Loading branch information
Showing
10 changed files
with
172 additions
and
12 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
api/src/main/java/ca/bc/gov/educ/eas/api/constants/EventType.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 |
---|---|---|
@@ -1,6 +1,9 @@ | ||
package ca.bc.gov.educ.eas.api.constants; | ||
|
||
public enum EventType { | ||
INITIATED, //Default. Used by BaseOrchestrator. | ||
MARK_SAGA_COMPLETE, //Default. Used by BaseOrchestrator. | ||
GET_PAGINATED_SCHOOLS, | ||
CREATE_STUDENT_REGISTRATION, | ||
GET_STUDENT_REGISTRATION | ||
} |
75 changes: 75 additions & 0 deletions
75
api/src/main/java/ca/bc/gov/educ/eas/api/model/v1/AssessmentStudentHistoryEntity.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,75 @@ | ||
package ca.bc.gov.educ.eas.api.model.v1; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import jakarta.persistence.*; | ||
import jakarta.validation.constraints.PastOrPresent; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import org.hibernate.annotations.UuidGenerator; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.UUID; | ||
|
||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Entity | ||
@Builder | ||
@Table(name = "ASSESSMENT_STUDENT_HISTORY") | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public class AssessmentStudentHistoryEntity { | ||
|
||
@Id | ||
@GeneratedValue(generator = "UUID") | ||
@UuidGenerator | ||
@Column(name = "ASSESSMENT_STUDENT_HISTORY_ID", unique = true, updatable = false, columnDefinition = "BINARY(16)") | ||
private UUID assessmentStudentHistoryID; | ||
|
||
@Basic | ||
@Column(name = "ASSESSMENT_STUDENT_ID", columnDefinition = "BINARY(16)") | ||
private UUID assessmentStudentID; | ||
|
||
@Basic | ||
@Column(name = "ASSESSMENT_ID", columnDefinition = "BINARY(16)") | ||
private UUID assessmentID; | ||
|
||
@Column(name = "SCHOOL_ID", nullable = false, columnDefinition = "BINARY(16)") | ||
private UUID schoolID; | ||
|
||
@Column(name = "STUDENT_ID", nullable = false, columnDefinition = "BINARY(16)") | ||
private UUID studentID; | ||
|
||
@Column(name = "PEN", nullable = false, length = 9) | ||
private String pen; | ||
|
||
@Column(name = "LOCAL_ID", length = 12) | ||
private String localID; | ||
|
||
@Column(name = "IS_ELECTRONIC_EXAM", length = 1) | ||
private Boolean isElectronicExam; | ||
|
||
@Column(name = "FINAL_PERCENTAGE", length = 3) | ||
private String finalPercentage; | ||
|
||
@Column(name = "PROVINCIAL_SPECIAL_CASE_CODE", length = 1) | ||
private String provincialSpecialCaseCode; | ||
|
||
@Column(name = "COURSE_STATUS_CODE", length = 1) | ||
private String courseStatusCode; | ||
|
||
@Column(name = "CREATE_USER", updatable = false, length = 100) | ||
private String createUser; | ||
|
||
@PastOrPresent | ||
@Column(name = "CREATE_DATE", updatable = false) | ||
private LocalDateTime createDate; | ||
|
||
@Column(name = "UPDATE_USER", length = 100) | ||
private String updateUser; | ||
|
||
@PastOrPresent | ||
@Column(name = "UPDATE_DATE") | ||
private LocalDateTime updateDate; | ||
} |
12 changes: 12 additions & 0 deletions
12
...rc/main/java/ca/bc/gov/educ/eas/api/repository/v1/AssessmentStudentHistoryRepository.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,12 @@ | ||
package ca.bc.gov.educ.eas.api.repository.v1; | ||
|
||
import ca.bc.gov.educ.eas.api.model.v1.AssessmentStudentHistoryEntity; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import java.util.List; | ||
import java.util.UUID; | ||
|
||
public interface AssessmentStudentHistoryRepository extends JpaRepository<AssessmentStudentHistoryEntity, UUID> { | ||
List<AssessmentStudentHistoryEntity> findAllByAssessmentIDAndAssessmentStudentID(UUID asessmentID, UUID assessmentStudentID); | ||
|
||
} |
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
29 changes: 29 additions & 0 deletions
29
api/src/main/java/ca/bc/gov/educ/eas/api/service/v1/AssessmentStudentHistoryService.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,29 @@ | ||
package ca.bc.gov.educ.eas.api.service.v1; | ||
|
||
import ca.bc.gov.educ.eas.api.model.v1.AssessmentStudentEntity; | ||
import ca.bc.gov.educ.eas.api.model.v1.AssessmentStudentHistoryEntity; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.beans.BeanUtils; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Propagation; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Service | ||
@Slf4j | ||
public class AssessmentStudentHistoryService { | ||
|
||
@Transactional(propagation = Propagation.MANDATORY) | ||
public AssessmentStudentHistoryEntity createAssessmentStudentHistoryEntity(AssessmentStudentEntity assessmentStudentEntity, String updateUser) { | ||
final AssessmentStudentHistoryEntity assessmentStudentHistoryEntity = new AssessmentStudentHistoryEntity(); | ||
BeanUtils.copyProperties(assessmentStudentEntity, assessmentStudentHistoryEntity); | ||
assessmentStudentHistoryEntity.setAssessmentStudentID(assessmentStudentEntity.getAssessmentStudentID()); | ||
assessmentStudentHistoryEntity.setAssessmentID(assessmentStudentEntity.getAssessmentEntity().getAssessmentID()); | ||
assessmentStudentHistoryEntity.setCreateUser(updateUser); | ||
assessmentStudentHistoryEntity.setCreateDate(LocalDateTime.now()); | ||
assessmentStudentHistoryEntity.setUpdateUser(updateUser); | ||
assessmentStudentHistoryEntity.setUpdateDate(LocalDateTime.now()); | ||
return assessmentStudentHistoryEntity; | ||
} | ||
} |
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
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,19 @@ | ||
CREATE TABLE ASSESSMENT_STUDENT_HISTORY | ||
( | ||
ASSESSMENT_STUDENT_HISTORY_ID UUID NOT NULL, | ||
ASSESSMENT_STUDENT_ID UUID NOT NULL, | ||
ASSESSMENT_ID UUID NOT NULL, | ||
SCHOOL_ID UUID NOT NULL, | ||
STUDENT_ID UUID NOT NULL, | ||
PEN VARCHAR(9) NOT NULL, | ||
LOCAL_ID VARCHAR(12), | ||
IS_ELECTRONIC_EXAM BOOLEAN, | ||
FINAL_PERCENTAGE VARCHAR(3), | ||
PROVINCIAL_SPECIAL_CASE_CODE VARCHAR(1), | ||
COURSE_STATUS_CODE VARCHAR(1), | ||
CREATE_USER VARCHAR(100) NOT NULL, | ||
CREATE_DATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, | ||
UPDATE_USER VARCHAR(100) NOT NULL, | ||
UPDATE_DATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, | ||
CONSTRAINT ASSESSMENT_STUDENT_HISTORY_ID_PK PRIMARY KEY (ASSESSMENT_STUDENT_HISTORY_ID) | ||
); |
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