Skip to content

Commit 00cdec0

Browse files
PI-2543 Create initial project for appointment-reminders-and-delius (#4334)
* PI-2543 Create initial project for appointment-reminders-and-delius * Update access.yml --------- Co-authored-by: probation-integration-bot[bot] <177347787+probation-integration-bot[bot]@users.noreply.github.com> Co-authored-by: Marcus Aspin <[email protected]>
1 parent 93cf7f3 commit 00cdec0

File tree

36 files changed

+670
-0
lines changed

36 files changed

+670
-0
lines changed

.github/workflows/access.yml

+1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ on:
5656
- '["subject-access-requests-and-delius"]'
5757
- '["common-platform-and-delius"]'
5858
- '["ims-and-delius"]'
59+
- '["appointment-reminders-and-delius"]'
5960
# ^ add new projects here
6061
# GitHub Actions doesn't support dynamic choices, we must add each project here to enable manual deployments
6162
# See https://github.com/community/community/discussions/11795

.github/workflows/build.yml

+1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ jobs:
7979
- subject-access-requests-and-delius
8080
- common-platform-and-delius
8181
- ims-and-delius
82+
- appointment-reminders-and-delius
8283
# ^ add new projects here
8384
# GitHub Actions doesn't support dynamic choices, we must add each project here to enable manual deployments
8485
# See https://github.com/community/community/discussions/11795

.github/workflows/deploy.yml

+1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ on:
7171
- '["subject-access-requests-and-delius"]'
7272
- '["common-platform-and-delius"]'
7373
- '["ims-and-delius"]'
74+
- '["appointment-reminders-and-delius"]'
7475
# ^ add new projects here
7576
# GitHub Actions doesn't support dynamic choices, we must add each project here to enable manual deployments
7677
# See https://github.com/community/community/discussions/11795

.github/workflows/service-catalogue.yml

+1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ on:
5656
- '["subject-access-requests-and-delius"]'
5757
- '["common-platform-and-delius"]'
5858
- '["ims-and-delius"]'
59+
- '["appointment-reminders-and-delius"]'
5960
# ^ add new projects here
6061
# GitHub Actions doesn't support dynamic choices, we must add each project here to enable manual deployments
6162
# See https://github.com/community/community/discussions/11795

.idea/runConfigurations/appointment_reminders_and_delius.xml

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

doc/tech-docs/source/services.html.md.erb

+1
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,5 @@ weight: 20
8383
* [Subject Access Requests And Delius](https://ministryofjustice.github.io/hmpps-probation-integration-services/tech-docs/projects/subject-access-requests-and-delius)
8484
* [Common Platform And Delius](https://ministryofjustice.github.io/hmpps-probation-integration-services/tech-docs/projects/common-platform-and-delius)
8585
* [Ims And Delius](https://ministryofjustice.github.io/hmpps-probation-integration-services/tech-docs/projects/ims-and-delius)
86+
* [Appointment Reminders And Delius](https://ministryofjustice.github.io/hmpps-probation-integration-services/tech-docs/projects/appointment-reminders-and-delius)
8687
<li style="display: none">^ add new projects here</li>

projects/appointment-reminders-and-delius/.trivyignore

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# appointment-reminders-and-delius
2+
3+
// TODO Describe the service
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{
2+
"role": {
3+
"name": "appointment-reminders-and-delius"
4+
},
5+
"customDimensions": {
6+
"service.version": "${VERSION}",
7+
"service.team": "probation-integration"
8+
},
9+
"instrumentation": {
10+
"logging": {
11+
"level": "DEBUG"
12+
},
13+
"springScheduling": {
14+
"enabled": false
15+
}
16+
},
17+
"selfDiagnostics": {
18+
"destination": "console"
19+
},
20+
"sampling": {
21+
"percentage": 100
22+
},
23+
"preview": {
24+
"sampling": {
25+
"overrides": [
26+
{
27+
"telemetryType": "request",
28+
"attributes": [
29+
{
30+
"key": "http.url",
31+
"value": "https?://[^/]+/health/?.*",
32+
"matchType": "regexp"
33+
}
34+
],
35+
"percentage": 0
36+
},
37+
{
38+
"telemetryType": "request",
39+
"attributes": [
40+
{
41+
"key": "http.url",
42+
"value": "https?://[^/]+/info/?.*",
43+
"matchType": "regexp"
44+
}
45+
],
46+
"percentage": 0
47+
},
48+
{
49+
"telemetryType": "dependency",
50+
"attributes": [
51+
{
52+
"key": "db.operation",
53+
"value": "SELECT",
54+
"matchType": "strict"
55+
}
56+
],
57+
"percentage": 10
58+
}
59+
]
60+
}
61+
}
62+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import uk.gov.justice.digital.hmpps.extensions.ClassPathExtension
2+
3+
apply(plugin = "com.google.cloud.tools.jib")
4+
5+
dependencies {
6+
implementation(project(":libs:audit"))
7+
implementation(project(":libs:commons"))
8+
implementation(project(":libs:oauth-server"))
9+
10+
implementation("org.springframework.boot:spring-boot-starter-actuator")
11+
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
12+
implementation("org.springframework.boot:spring-boot-starter-security")
13+
implementation("org.springframework.boot:spring-boot-starter-validation")
14+
implementation("org.springframework.boot:spring-boot-starter-web")
15+
implementation("org.jetbrains.kotlin:kotlin-reflect")
16+
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
17+
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
18+
implementation(libs.springdoc)
19+
20+
dev(project(":libs:dev-tools"))
21+
dev("com.h2database:h2")
22+
dev("org.testcontainers:oracle-xe")
23+
24+
runtimeOnly("com.oracle.database.jdbc:ojdbc11")
25+
26+
testImplementation("org.springframework.boot:spring-boot-starter-test")
27+
testImplementation(libs.bundles.mockito)
28+
}
29+
30+
configure<ClassPathExtension> {
31+
jacocoExclusions = listOf(
32+
"**/config/**",
33+
"**/entity/**",
34+
"**/AppKt.class"
35+
)
36+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: v2
2+
appVersion: '1.0'
3+
description: A Helm chart for Kubernetes
4+
name: appointment-reminders-and-delius
5+
version: 1.0.0
6+
7+
dependencies:
8+
- name: generic-service
9+
version: "3.2"
10+
repository: https://ministryofjustice.github.io/hmpps-helm-charts
11+
- name: generic-prometheus-alerts
12+
version: "1.4"
13+
repository: https://ministryofjustice.github.io/hmpps-helm-charts
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
database:
2+
access:
3+
username_key: /appointment-reminders-and-delius/db-username
4+
password_key: /appointment-reminders-and-delius/db-password
5+
6+
audit:
7+
username: AppointmentRemindersAndDelius
8+
forename: Appointment Reminders
9+
surname: Service
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
enabled: false # TODO set this to true when you're ready to deploy your service
2+
3+
generic-service:
4+
ingress:
5+
host: appointment-reminders-and-delius-dev.hmpps.service.justice.gov.uk
6+
7+
scheduledDowntime:
8+
enabled: true
9+
10+
env:
11+
SENTRY_ENVIRONMENT: dev
12+
LOGGING_LEVEL_UK_GOV_DIGITAL_JUSTICE_HMPPS: DEBUG
13+
SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_JWK_SET_URI: https://sign-in-dev.hmpps.service.justice.gov.uk/auth/.well-known/jwks.json
14+
SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_ISSUER_URI: https://sign-in-dev.hmpps.service.justice.gov.uk/auth/issuer
15+
16+
generic-prometheus-alerts:
17+
businessHoursOnly: true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
enabled: false # TODO set this to true when you're ready to deploy your service
2+
3+
generic-service:
4+
ingress:
5+
host: appointment-reminders-and-delius-preprod.hmpps.service.justice.gov.uk
6+
7+
scheduledDowntime:
8+
enabled: true
9+
10+
env:
11+
SENTRY_ENVIRONMENT: preprod
12+
SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_JWK_SET_URI: https://sign-in-preprod.hmpps.service.justice.gov.uk/auth/.well-known/jwks.json
13+
SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_ISSUER_URI: https://sign-in-preprod.hmpps.service.justice.gov.uk/auth/issuer
14+
15+
generic-prometheus-alerts:
16+
businessHoursOnly: true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
enabled: false # TODO set this to true when you're ready to deploy your service
2+
3+
generic-service:
4+
ingress:
5+
host: appointment-reminders-and-delius.hmpps.service.justice.gov.uk
6+
7+
env:
8+
SENTRY_ENVIRONMENT: prod
9+
SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_JWK_SET_URI: https://sign-in.hmpps.service.justice.gov.uk/auth/.well-known/jwks.json
10+
SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_ISSUER_URI: https://sign-in.hmpps.service.justice.gov.uk/auth/issuer
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Common values
2+
generic-service:
3+
productId: HMPPS518
4+
nameOverride: appointment-reminders-and-delius
5+
6+
image:
7+
repository: ghcr.io/ministryofjustice/hmpps-probation-integration-services/appointment-reminders-and-delius
8+
9+
ingress:
10+
tlsSecretName: appointment-reminders-and-delius-cert
11+
12+
namespace_secrets:
13+
common:
14+
SPRING_DATASOURCE_URL: DB_URL
15+
appointment-reminders-and-delius-database:
16+
SPRING_DATASOURCE_USERNAME: DB_USERNAME
17+
SPRING_DATASOURCE_PASSWORD: DB_PASSWORD
18+
appointment-reminders-and-delius-sentry:
19+
SENTRY_DSN: SENTRY_DSN
20+
21+
generic-prometheus-alerts:
22+
targetApplication: appointment-reminders-and-delius
23+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rootProject.name = "appointment-reminders-and-delius"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package uk.gov.justice.digital.hmpps.data
2+
3+
import jakarta.annotation.PostConstruct
4+
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
5+
import org.springframework.boot.context.event.ApplicationReadyEvent
6+
import org.springframework.context.ApplicationListener
7+
import org.springframework.stereotype.Component
8+
import uk.gov.justice.digital.hmpps.data.generator.UserGenerator
9+
import uk.gov.justice.digital.hmpps.user.AuditUserRepository
10+
11+
@Component
12+
@ConditionalOnProperty("seed.database")
13+
class DataLoader(
14+
private val auditUserRepository: AuditUserRepository
15+
) : ApplicationListener<ApplicationReadyEvent> {
16+
17+
@PostConstruct
18+
fun saveAuditUser() {
19+
auditUserRepository.save(UserGenerator.AUDIT_USER)
20+
}
21+
22+
override fun onApplicationEvent(are: ApplicationReadyEvent) {
23+
// Perform dev/test database setup here, using JPA repositories and generator classes...
24+
}
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package uk.gov.justice.digital.hmpps.data.generator
2+
3+
import uk.gov.justice.digital.hmpps.user.AuditUser
4+
5+
object UserGenerator {
6+
val AUDIT_USER = AuditUser(IdGenerator.getAndIncrement(), "AppointmentRemindersAndDelius")
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package uk.gov.justice.digital.hmpps
2+
3+
import org.junit.jupiter.api.Test
4+
import org.springframework.beans.factory.annotation.Autowired
5+
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc
6+
import org.springframework.boot.test.context.SpringBootTest
7+
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT
8+
import org.springframework.boot.test.mock.mockito.MockBean
9+
import org.springframework.test.web.servlet.MockMvc
10+
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get
11+
import org.springframework.test.web.servlet.result.MockMvcResultMatchers.status
12+
import uk.gov.justice.digital.hmpps.test.MockMvcExtensions.withToken
13+
import uk.gov.justice.digital.hmpps.telemetry.TelemetryService
14+
15+
@AutoConfigureMockMvc
16+
@SpringBootTest(webEnvironment = RANDOM_PORT)
17+
internal class IntegrationTest {
18+
@Autowired
19+
lateinit var mockMvc: MockMvc
20+
21+
@MockBean
22+
lateinit var telemetryService: TelemetryService
23+
24+
@Test
25+
fun `API call retuns a success response`() {
26+
mockMvc
27+
.perform(get("/example/123").withToken())
28+
.andExpect(status().is2xxSuccessful)
29+
}
30+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package uk.gov.justice.digital.hmpps
2+
3+
import org.springframework.boot.autoconfigure.SpringBootApplication
4+
import org.springframework.boot.runApplication
5+
6+
@SpringBootApplication
7+
class App
8+
9+
fun main(args: Array<String>) {
10+
runApplication<App>(*args)
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package uk.gov.justice.digital.hmpps.controller
2+
3+
import org.springframework.security.access.prepost.PreAuthorize
4+
import org.springframework.web.bind.annotation.GetMapping
5+
import org.springframework.web.bind.annotation.PathVariable
6+
import org.springframework.web.bind.annotation.RestController
7+
8+
@RestController
9+
class ApiController {
10+
@PreAuthorize("hasRole('EXAMPLE')")
11+
@GetMapping(value = ["/example/{inputId}"])
12+
fun handle(
13+
@PathVariable("inputId") inputId: String
14+
) {
15+
// TODO Not yet implemented
16+
}
17+
}

0 commit comments

Comments
 (0)