Skip to content

Commit

Permalink
Formatting changes
Browse files Browse the repository at this point in the history
  • Loading branch information
probation-integration-bot[bot] authored Dec 16, 2024
1 parent b07c6ed commit 3255032
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,17 @@ object OffenderManagerGenerator {
val STAFF_TEAM = ContactStaffTeam(StaffTeamLinkId(STAFF_1.id, TEAM))

val DEFAULT_LOCATION =
Location(IdGenerator.getAndIncrement(), "B20", "1 Birmingham Street", "Bham House", "1", "Birmingham Street", "Birmingham", "West Midlands", "B20 3BA")
Location(
IdGenerator.getAndIncrement(),
"B20",
"1 Birmingham Street",
"Bham House",
"1",
"Birmingham Street",
"Birmingham",
"West Midlands",
"B20 3BA"
)

val TEAM_OFFICE = TeamOfficeLink(TeamOfficeLinkId(TEAM.id, DEFAULT_LOCATION))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class SentencesIntegrationTest {
@Autowired
lateinit var mockMvc: MockMvc


@Test
fun `unauthorized status returned`() {
mockMvc
Expand All @@ -42,7 +41,9 @@ class SentencesIntegrationTest {
@Test
fun `no active sentences`() {
val response = mockMvc
.perform(MockMvcRequestBuilders.get("/sentences/${PersonDetailsGenerator.PERSONAL_DETAILS.crn}").withToken())
.perform(
MockMvcRequestBuilders.get("/sentences/${PersonDetailsGenerator.PERSONAL_DETAILS.crn}").withToken()
)
.andExpect(MockMvcResultMatchers.status().isOk)
.andReturn().response.contentAsJson<MinimalSentenceOverview>()

Expand Down Expand Up @@ -75,7 +76,8 @@ class SentencesIntegrationTest {
),
requirements = listOf(
MinimalRequirement(REQUIREMENT.id, "1 days RAR, 1 completed"),
MinimalRequirement(REQUIREMENT_UNPAID_WORK.id, "Unpaid Work - Intensive"))
MinimalRequirement(REQUIREMENT_UNPAID_WORK.id, "Unpaid Work - Intensive")
)
)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,25 @@ class UserLocationIntegrationTest {

@Test
fun `get user locations`() {
val response = mockMvc.perform(MockMvcRequestBuilders.get("/user/peter-parker/locations").withToken())
.andDo(print())
.andExpect(MockMvcResultMatchers.status().isOk)
.andReturn().response.contentAsJson<UserOfficeLocation>()
val response = mockMvc.perform(MockMvcRequestBuilders.get("/user/peter-parker/locations").withToken())
.andDo(print())
.andExpect(MockMvcResultMatchers.status().isOk)
.andReturn().response.contentAsJson<UserOfficeLocation>()

val expected = UserOfficeLocation(
val expected = UserOfficeLocation(
Name(STAFF_USER_1.forename, surname = STAFF_USER_1.surname),
listOf(LocationDetails(
DEFAULT_LOCATION.id,
DEFAULT_LOCATION.description,
Address(DEFAULT_LOCATION.buildingNumber, DEFAULT_LOCATION.streetName, DEFAULT_LOCATION.townCity, DEFAULT_LOCATION.county, DEFAULT_LOCATION.postcode))
listOf(
LocationDetails(
DEFAULT_LOCATION.id,
DEFAULT_LOCATION.description,
Address(
DEFAULT_LOCATION.buildingNumber,
DEFAULT_LOCATION.streetName,
DEFAULT_LOCATION.townCity,
DEFAULT_LOCATION.county,
DEFAULT_LOCATION.postcode
)
)
)
)
assertEquals(expected, response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore
import java.time.ZonedDateTime
import java.util.*

data class CreateAppointment (
data class CreateAppointment(
val user: User,
val type: Type,
val start: ZonedDateTime,
Expand All @@ -21,7 +21,7 @@ data class CreateAppointment (
@JsonIgnore
val urn = URN_PREFIX + uuid

enum class Type (val code: String) {
enum class Type(val code: String) {
HomeVisitToCaseNS("CHVS"),
InitialAppointmentInOfficeNS("COAI"),
PlannedOfficeVisitNS("COAP"),
Expand All @@ -40,12 +40,12 @@ data class CreateAppointment (
}
}

data class User (
data class User(
val username: String,
val locationId: Long
)

data class OverlappingAppointment (
data class OverlappingAppointment(
val start: String,
val end: String,
)
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ data class UserOfficeLocation(

data class Name(
val forename: String,
val middleName: String? = null ,
val middleName: String? = null,
val surname: String
)

data class LocationDetails(
val id: Long,
val description: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class StaffUser(
val forename2: String? = null,

val surname: String
) {
) {
@Transient
var email: String? = null

Expand All @@ -101,7 +101,7 @@ interface StaffUserRepository : JpaRepository<StaffUser, Long> {
WHERE UPPER(u.username) = UPPER(:username)
"""
)
fun findByUsername(username: String) : StaffUser?
fun findByUsername(username: String): StaffUser?

@Query(
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ class SentenceAppointmentService(
checkForConflicts(createAppointment)

val userAndLocation =
staffUserRepository.getUserAndLocation(createAppointment.user.username, createAppointment.user.locationId)
staffUserRepository.getUserAndLocation(
createAppointment.user.username,
createAppointment.user.locationId
)
val createAppointments: ArrayList<CreateAppointment> = arrayListOf()

createAppointment.let {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class UserLocationService(private val staffUserRepository: StaffUserRepository)

return UserOfficeLocation(
Name(user.forename, user.forename2, user.surname),
userLocations.map { it.toLocationDetails()}
userLocations.map { it.toLocationDetails() }
)
}

Expand Down

0 comments on commit 3255032

Please sign in to comment.