Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change endpoint from /learner-events/nomisId to /match/{nomisId}/learner-events #113

Merged
merged 3 commits into from
Mar 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import io.swagger.v3.oas.annotations.media.Schema
import io.swagger.v3.oas.annotations.parameters.RequestBody
import io.swagger.v3.oas.annotations.responses.ApiResponse
import io.swagger.v3.oas.annotations.security.SecurityRequirement
import uk.gov.justice.digital.hmpps.learnerrecordsapi.config.Roles.ROLE_LEARNERS_RO
import uk.gov.justice.digital.hmpps.learnerrecordsapi.config.Roles.ROLE_LEARNERS_UI
import uk.gov.justice.digital.hmpps.learnerrecordsapi.models.response.LearnerEventsResponse
import uk.gov.justice.hmpps.kotlin.common.ErrorResponse
Expand Down Expand Up @@ -219,167 +218,3 @@ import uk.gov.justice.hmpps.kotlin.common.ErrorResponse
],
)
annotation class LearnerEventsApi

@Target(AnnotationTarget.FUNCTION)
@Retention(AnnotationRetention.RUNTIME)
@Operation(
summary = "Get learning events by Nomis ID",
description = "Get personal learning records and events by Nomis ID",
parameters = [Parameter(name = "X-Username", `in` = ParameterIn.HEADER, required = true)],
requestBody = RequestBody(
description = "Nomis ID of the learner",
required = true,
content = [
Content(
mediaType = "application/json",
examples = [
ExampleObject(
value = """
{
"nomisId": "123456"
}
""",
),
],
),
],
),
security = [SecurityRequirement(name = ROLE_LEARNERS_RO)],
responses = [
ApiResponse(
responseCode = "200",
description = "The request was successful and a response was returned.",
content = [
Content(
mediaType = "application/json",
schema = Schema(implementation = LearnerEventsResponse::class),
examples = [
ExampleObject(
name = "Exact Match Response",
value = """
{
"searchParameters": {
"givenName": "Sean",
"familyName": "Findlay",
"uln": "1174112637",
"dateOfBirth": "1980-11-01",
"gender": "MALE"
},
"responseType": "Exact Match",
"foundUln": "1174112637",
"incomingUln": "1174112637",
"learnerRecord": [
{
"id": "2931",
"achievementProviderUkprn": "10030488",
"achievementProviderName": "LUTON PENTECOSTAL CHURCH",
"awardingOrganisationName": "UNKNOWN",
"qualificationType": "GCSE",
"subjectCode": "50079116",
"achievementAwardDate": "2011-10-24",
"credits": "0",
"source": "ILR",
"dateLoaded": "2012-05-31 16:47:04",
"underDataChallenge": "N",
"level": "",
"status": "F",
"subject": "GCSE in English Literature",
"grade": "9999999999",
"awardingOrganisationUkprn": "UNKNWN",
"collectionType": "W",
"returnNumber": "02",
"participationStartDate": "2011-10-02",
"participationEndDate": "2011-10-24"
}
]
}
""",
),
ExampleObject(
name = "Linked Learner Match Response",
value = """
{
"searchParameters": {
"givenName": "Connor",
"familyName": "Carroll",
"uln": "4444599390"
},
"responseType": "Linked Learner Match",
"foundUln": "6936002314",
"incomingUln": "4444599390",
"learnerRecord": [
{
"id": "4284",
"achievementProviderUkprn": "10032743",
"achievementProviderName": "PRIORSLEE PRIMARY SCHOOL ACADEMY TRUST",
"awardingOrganisationName": "UNKNOWN",
"qualificationType": "NVQ/GNVQ Key Skills Unit",
"subjectCode": "1000323X",
"achievementAwardDate": "2010-09-26",
"credits": "0",
"source": "ILR",
"dateLoaded": "2012-05-31 16:47:04",
"underDataChallenge": "N",
"level": "",
"status": "F",
"subject": "Key Skills in Application of Number - level 1",
"grade": "9999999999",
"awardingOrganisationUkprn": "UNKNWN",
"collectionType": "W",
"returnNumber": "02",
"participationStartDate": "2010-09-01",
"participationEndDate": "2010-09-26"
}
]
}
""",
),
ExampleObject(
name = "Learner opted to not share data Response",
value = """
{
"searchParameters": {
"givenName": "John",
"familyName": "Smith",
"uln": "1026922983"
},
"responseType": "Learner opted to not share data",
"foundUln": "1026922983",
"incomingUln": "1026922983",
"learnerRecord": []
}
""",
),
ExampleObject(
name = "Learner could not be verified Response",
value = """
{
"searchParameters": {
"givenName": "John",
"familyName": "Smith",
"uln": "1174112637"
},
"responseType": "Learner could not be verified",
"foundUln": "",
"incomingUln": "1174112637",
"learnerRecord": []
}
""",
),
],
),
],
),
ApiResponse(
responseCode = "401",
description = "Unauthorized to access this endpoint",
content = [Content(mediaType = "application/json", schema = Schema(implementation = ErrorResponse::class))],
),
ApiResponse(
responseCode = "403",
description = "Forbidden to access this endpoint",
content = [Content(mediaType = "application/json", schema = Schema(implementation = ErrorResponse::class))],
),
],
)
annotation class LearnerEventsByNomisIdApi
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse
import io.swagger.v3.oas.annotations.security.SecurityRequirement
import uk.gov.justice.digital.hmpps.learnerrecordsapi.config.Roles.ROLE_LEARNERS_UI
import uk.gov.justice.digital.hmpps.learnerrecordsapi.models.request.ConfirmMatchRequest
import uk.gov.justice.digital.hmpps.learnerrecordsapi.models.response.LearnerEventsResponse
import uk.gov.justice.hmpps.kotlin.common.ErrorResponse

@Target(AnnotationTarget.FUNCTION)
Expand Down Expand Up @@ -61,3 +62,150 @@ import uk.gov.justice.hmpps.kotlin.common.ErrorResponse
],
)
annotation class MatchConfirmApi

@Target(AnnotationTarget.FUNCTION)
@Retention(AnnotationRetention.RUNTIME)
@Operation(
summary = "Get learning events by Nomis ID",
description = "Get personal learning records and events by Nomis ID",
parameters = [
Parameter(name = "X-Username", `in` = ParameterIn.HEADER, required = true),
Parameter(name = "nomisId", `in` = ParameterIn.PATH, required = true),
],
security = [SecurityRequirement(name = "learner-records-search-read-only-role")],
responses = [
ApiResponse(
responseCode = "200",
description = "The request was successful and a response was returned.",
content = [
Content(
mediaType = "application/json",
schema = Schema(implementation = LearnerEventsResponse::class),
examples = [
ExampleObject(
name = "Exact Match Response",
value = """
{
"searchParameters": {
"givenName": "Sean",
"familyName": "Findlay",
"uln": "1174112637"
},
"responseType": "Exact Match",
"foundUln": "1174112637",
"incomingUln": "1174112637",
"learnerRecord": [
{
"id": "2931",
"achievementProviderUkprn": "10030488",
"achievementProviderName": "LUTON PENTECOSTAL CHURCH",
"awardingOrganisationName": "UNKNOWN",
"qualificationType": "GCSE",
"subjectCode": "50079116",
"achievementAwardDate": "2011-10-24",
"credits": "0",
"source": "ILR",
"dateLoaded": "2012-05-31 16:47:04",
"underDataChallenge": "N",
"level": "",
"status": "F",
"subject": "GCSE in English Literature",
"grade": "9999999999",
"awardingOrganisationUkprn": "UNKNWN",
"collectionType": "W",
"returnNumber": "02",
"participationStartDate": "2011-10-02",
"participationEndDate": "2011-10-24"
}
]
}
""",
),
ExampleObject(
name = "Linked Learner Match Response",
value = """
{
"searchParameters": {
"givenName": "Connor",
"familyName": "Carroll",
"uln": "4444599390"
},
"responseType": "Linked Learner Match",
"foundUln": "6936002314",
"incomingUln": "4444599390",
"learnerRecord": [
{
"id": "4284",
"achievementProviderUkprn": "10032743",
"achievementProviderName": "PRIORSLEE PRIMARY SCHOOL ACADEMY TRUST",
"awardingOrganisationName": "UNKNOWN",
"qualificationType": "NVQ/GNVQ Key Skills Unit",
"subjectCode": "1000323X",
"achievementAwardDate": "2010-09-26",
"credits": "0",
"source": "ILR",
"dateLoaded": "2012-05-31 16:47:04",
"underDataChallenge": "N",
"level": "",
"status": "F",
"subject": "Key Skills in Application of Number - level 1",
"grade": "9999999999",
"awardingOrganisationUkprn": "UNKNWN",
"collectionType": "W",
"returnNumber": "02",
"participationStartDate": "2010-09-01",
"participationEndDate": "2010-09-26"
}
]
}
""",
),
ExampleObject(
name = "Learner opted to not share data Response",
value = """
{
"searchParameters": {
"givenName": "John",
"familyName": "Smith",
"uln": "1026922983"
},
"responseType": "Learner opted to not share data",
"foundUln": "1026922983",
"incomingUln": "1026922983",
"learnerRecord": []
}
""",
),
ExampleObject(
name = "Learner could not be verified Response",
value = """
{
"searchParameters": {
"givenName": "John",
"familyName": "Smith",
"uln": "1174112637"
},
"responseType": "Learner could not be verified",
"foundUln": "",
"incomingUln": "1174112637",
"learnerRecord": []
}
""",
),
],
),
],
),
ApiResponse(
responseCode = "401",
description = "Unauthorized to access this endpoint",
content = [Content(mediaType = "application/json", schema = Schema(implementation = ErrorResponse::class))],
),
ApiResponse(
responseCode = "403",
description = "Forbidden to access this endpoint",
content = [Content(mediaType = "application/json", schema = Schema(implementation = ErrorResponse::class))],
),
],
)
annotation class LearnerEventsByNomisIdApi
Loading