-
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.
Merge branch 'feature/OPHKIOS-115' into feature/OPHKIOS-116
- Loading branch information
Showing
125 changed files
with
3,922 additions
and
369 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
|
||
# Fetch municipalities from koodisto, save returned json for backend to use, generate frontend localisation files. | ||
|
||
BACKEND_PATH=../src/main/resources/koodisto | ||
BACKEND_KOODISTO_FILE=${BACKEND_PATH}/koodisto_kunnat.json | ||
mkdir -p $BACKEND_PATH | ||
FRONTEND_PATH=../../../frontend/packages/vkt/public/i18n | ||
|
||
mkdir -p $FRONTEND_PATH | ||
function fetch_and_transform_koodisto_results_for_backend_use() { | ||
koodistoURL="https://virkailija.opintopolku.fi/koodisto-service/rest/json/kunta/koodi" | ||
# Read municipalities, filter out expired ones, filter out irrelevant codes (198,199,999), pick and transform relevant fields | ||
jq_extract_cmd="[.[] | select(.voimassaLoppuPvm | type == \"null\") | select(.koodiArvo != \"198\" and .koodiArvo != \"199\" and .koodiArvo != \"999\")|{koodiUri, resourceUri, versio, koodiArvo, voimassaAlkuPvm, paivitysPvm, fi: (.metadata[] | select(.kieli == \"FI\") | .nimi), sv: (.metadata[] | select(.kieli == \"SV\") | .nimi)} ]" | ||
curl -H "Caller-Id:kehittaja-vkt" "$koodistoURL" | jq -c "$jq_extract_cmd" > $BACKEND_KOODISTO_FILE | ||
} | ||
|
||
function extract_frontend_localisation() { | ||
lang=$1 | ||
locale=$2 | ||
jq_extract_cmd="[.[] | {key: .koodiArvo, value: .${lang} }] | sort_by(.key) | from_entries" | ||
jq_obj_wrap_cmd='. | {vkt:{koodisto:{municipalities:.}}}' | ||
output="${FRONTEND_PATH}/${locale}/koodisto_municipalities.json" | ||
echo "Command for jq: $jq_extract_cmd" | ||
echo "Outputting to: $output" | ||
jq "$jq_extract_cmd" $BACKEND_KOODISTO_FILE | jq "$jq_obj_wrap_cmd" >"${output}" | ||
echo "ok" | ||
} | ||
|
||
fetch_and_transform_koodisto_results_for_backend_use | ||
extract_frontend_localisation 'fi' 'fi-FI' | ||
extract_frontend_localisation 'sv' 'sv-SE' |
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
27 changes: 27 additions & 0 deletions
27
backend/vkt/src/main/java/fi/oph/vkt/api/clerk/ClerkExaminerController.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,27 @@ | ||
package fi.oph.vkt.api.clerk; | ||
|
||
import fi.oph.vkt.api.dto.examiner.ExaminerDetailsDTO; | ||
import fi.oph.vkt.service.ClerkExaminerService; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import jakarta.annotation.Resource; | ||
import java.util.List; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequestMapping(value = "/api/v1/clerk/examiner", produces = MediaType.APPLICATION_JSON_VALUE) | ||
public class ClerkExaminerController { | ||
|
||
private static final String TAG_CLERK_EXAMINER = "Examiner API for OPH clerk users"; | ||
|
||
@Resource | ||
private ClerkExaminerService clerkExaminerService; | ||
|
||
@GetMapping | ||
@Operation(tags = TAG_CLERK_EXAMINER, summary = "List examiner details") | ||
public List<ExaminerDetailsDTO> listExaminers() { | ||
return clerkExaminerService.listExaminers(); | ||
} | ||
} |
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
8 changes: 8 additions & 0 deletions
8
backend/vkt/src/main/java/fi/oph/vkt/api/dto/MunicipalityDTO.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,8 @@ | ||
package fi.oph.vkt.api.dto; | ||
|
||
import jakarta.validation.constraints.NotNull; | ||
import lombok.Builder; | ||
import lombok.NonNull; | ||
|
||
@Builder | ||
public record MunicipalityDTO(@NonNull @NotNull String code) {} |
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
8 changes: 8 additions & 0 deletions
8
backend/vkt/src/main/java/fi/oph/vkt/api/dto/PublicExaminerExamDateDTO.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,8 @@ | ||
package fi.oph.vkt.api.dto; | ||
|
||
import java.time.LocalDate; | ||
import lombok.Builder; | ||
import lombok.NonNull; | ||
|
||
@Builder | ||
public record PublicExaminerExamDateDTO(@NonNull LocalDate examDate, @NonNull Boolean isFull) {} |
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
22 changes: 22 additions & 0 deletions
22
backend/vkt/src/main/java/fi/oph/vkt/api/dto/examiner/ExaminerDetailsDTO.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,22 @@ | ||
package fi.oph.vkt.api.dto.examiner; | ||
|
||
import fi.oph.vkt.api.dto.MunicipalityDTO; | ||
import jakarta.validation.constraints.NotEmpty; | ||
import java.util.List; | ||
import lombok.Builder; | ||
import lombok.NonNull; | ||
|
||
@Builder | ||
public record ExaminerDetailsDTO( | ||
@NonNull Long id, | ||
@NonNull Integer version, | ||
@NonNull String oid, | ||
@NonNull String email, | ||
@NonNull String phoneNumber, | ||
@NonNull String lastName, | ||
@NonNull String firstName, | ||
@NonNull Boolean examLanguageFinnish, | ||
@NonNull Boolean examLanguageSwedish, | ||
@NonNull Boolean isPublic, | ||
@NonNull @NotEmpty List<MunicipalityDTO> municipalities | ||
) {} |
7 changes: 7 additions & 0 deletions
7
backend/vkt/src/main/java/fi/oph/vkt/api/dto/examiner/ExaminerDetailsInitDTO.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,7 @@ | ||
package fi.oph.vkt.api.dto.examiner; | ||
|
||
import lombok.Builder; | ||
import lombok.NonNull; | ||
|
||
@Builder | ||
public record ExaminerDetailsInitDTO(@NonNull String oid, @NonNull String lastName, @NonNull String firstName) {} |
17 changes: 17 additions & 0 deletions
17
backend/vkt/src/main/java/fi/oph/vkt/api/dto/examiner/ExaminerDetailsUpsertDTO.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.api.dto.examiner; | ||
|
||
import fi.oph.vkt.api.dto.MunicipalityDTO; | ||
import jakarta.validation.constraints.NotEmpty; | ||
import java.util.List; | ||
import lombok.Builder; | ||
import lombok.NonNull; | ||
|
||
@Builder | ||
public record ExaminerDetailsUpsertDTO( | ||
@NonNull String email, | ||
@NonNull String phoneNumber, | ||
@NonNull Boolean examLanguageFinnish, | ||
@NonNull Boolean examLanguageSwedish, | ||
@NonNull Boolean isPublic, | ||
@NonNull @NotEmpty List<MunicipalityDTO> municipalities | ||
) {} |
7 changes: 7 additions & 0 deletions
7
backend/vkt/src/main/java/fi/oph/vkt/api/dto/examiner/ExaminerUserDTO.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,7 @@ | ||
package fi.oph.vkt.api.dto.examiner; | ||
|
||
import lombok.Builder; | ||
import lombok.NonNull; | ||
|
||
@Builder | ||
public record ExaminerUserDTO(@NonNull String oid) {} |
41 changes: 41 additions & 0 deletions
41
backend/vkt/src/main/java/fi/oph/vkt/api/examiner/ExaminerDetailsController.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,41 @@ | ||
package fi.oph.vkt.api.examiner; | ||
|
||
import fi.oph.vkt.api.dto.examiner.ExaminerDetailsDTO; | ||
import fi.oph.vkt.api.dto.examiner.ExaminerDetailsInitDTO; | ||
import fi.oph.vkt.api.dto.examiner.ExaminerDetailsUpsertDTO; | ||
import fi.oph.vkt.service.ExaminerDetailsService; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import jakarta.annotation.Resource; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
@RestController | ||
@RequestMapping(value = "/api/v1/tv/{oid}", produces = MediaType.APPLICATION_JSON_VALUE) | ||
public class ExaminerDetailsController { | ||
|
||
private static final String TAG_EXAMINER = "Examiner details API"; | ||
|
||
@Resource | ||
private ExaminerDetailsService examinerDetailsService; | ||
|
||
@GetMapping | ||
@Operation(tags = TAG_EXAMINER, summary = "Get examiner details") | ||
public ExaminerDetailsDTO getExaminerDetails(@PathVariable("oid") String oid) { | ||
return examinerDetailsService.getExaminer(oid); | ||
} | ||
|
||
@PostMapping(consumes = MediaType.APPLICATION_JSON_VALUE) | ||
@Operation(tags = TAG_EXAMINER, summary = "Create or update examiner") | ||
public ExaminerDetailsDTO upsertExaminer( | ||
@PathVariable("oid") String oid, | ||
@RequestBody ExaminerDetailsUpsertDTO examinerDetailsUpsertDTO | ||
) { | ||
return examinerDetailsService.upsertExaminer(oid, examinerDetailsUpsertDTO); | ||
} | ||
|
||
@GetMapping(path = "/init") | ||
@Operation(tags = TAG_EXAMINER, summary = "Get personal data needed for initializing examiner details") | ||
public ExaminerDetailsInitDTO getInitialExaminerDetails(@PathVariable("oid") String oid) { | ||
return examinerDetailsService.getInitialExaminerPersonalData(oid); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
backend/vkt/src/main/java/fi/oph/vkt/api/examiner/ExaminerExamEventController.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,23 @@ | ||
package fi.oph.vkt.api.examiner; | ||
|
||
import fi.oph.vkt.api.dto.clerk.ClerkExamEventListDTO; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import java.util.List; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequestMapping(value = "/api/v1/tv/{oid}/examEvent", produces = MediaType.APPLICATION_JSON_VALUE) | ||
public class ExaminerExamEventController { | ||
|
||
private static final String TAG_EXAMINER_EXAM_EVENT = "Exam event API for examiners"; | ||
|
||
@GetMapping | ||
@Operation(tags = TAG_EXAMINER_EXAM_EVENT, summary = "List all exam events") | ||
public List<ClerkExamEventListDTO> list(@PathVariable String oid) { | ||
return List.of(); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
backend/vkt/src/main/java/fi/oph/vkt/api/examiner/ExaminerUserController.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,19 @@ | ||
package fi.oph.vkt.api.examiner; | ||
|
||
import fi.oph.vkt.api.dto.examiner.ExaminerUserDTO; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.security.core.context.SecurityContextHolder; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequestMapping(value = "/api/v1/tv/user", produces = MediaType.APPLICATION_JSON_VALUE) | ||
public class ExaminerUserController { | ||
|
||
@GetMapping(path = "") | ||
public ExaminerUserDTO currentExaminerUser() { | ||
final String oid = SecurityContextHolder.getContext().getAuthentication().getName(); | ||
return ExaminerUserDTO.builder().oid(oid).build(); | ||
} | ||
} |
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
Oops, something went wrong.