Skip to content

Commit e6c9654

Browse files
committed
flytt htmx endepunkter under session
1 parent 71a0577 commit e6c9654

File tree

4 files changed

+16
-13
lines changed

4 files changed

+16
-13
lines changed

core/src/main/kotlin/no/javazone/feedback/qrcode/QRCode.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class QRCodeGenerator(private val logoFilePath: String = "duke_small.png") {
1010
.ofSquares()
1111
.withSize(40)
1212
.withLogo(logo = logoBytes, width = 100, height = 100)
13-
.build(data = "https://feedback.java.no/${feedbackChannel.externalId}")
13+
.build(data = "https://feedback.java.no/session/${feedbackChannel.externalId}")
1414
.renderToBytes()
1515
}
1616
}

core/src/main/kotlin/no/javazone/feedback/setupRouting.kt

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ fun Application.setupRouting() {
3636
val qrCodeGenerator = QRCodeGenerator()
3737

3838
staticResources("/static", "static")
39+
staticResources("/", "static")
3940

4041
get("/health") {
4142
if (isDatabaseHealthy()) {
@@ -45,16 +46,18 @@ fun Application.setupRouting() {
4546
}
4647
}
4748

48-
get("/{channelId}") {
49-
val channelId = call.parameters["channelId"]
50-
?: return@get call.respond(HttpStatusCode.NotFound)
51-
val channel = feedbackAdapter.findChannel(channelId)
52-
?: return@get call.respond(HttpStatusCode.NotFound, "Channel not found")
53-
call.respondHtml { feedbackPage(channel) }
54-
}
49+
route("session") {
50+
get("/{channelId}") {
51+
val channelId = call.parameters["channelId"]
52+
?: return@get call.respond(HttpStatusCode.NotFound)
53+
val channel = feedbackAdapter.findChannel(channelId)
54+
?: return@get call.respond(HttpStatusCode.NotFound, "Channel not found")
55+
call.respondHtml { feedbackPage(channel) }
56+
}
5557

56-
get("/{channelId}/thank-you") {
57-
call.respondHtml { thankYouFragment() }
58+
get("/{channelId}/thank-you") {
59+
call.respondHtml { thankYouFragment() }
60+
}
5861
}
5962

6063
route("/v1/feedback") {
15 KB
Binary file not shown.

core/src/test/kotlin/no/javazone/feedback/FeedbackEndpointsTest.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ class FeedbackEndpointsTest {
264264
)
265265
}.body<FeedbackChannelDTO>()
266266

267-
val response = client.get("/${channel.channelId}")
267+
val response = client.get("/session/${channel.channelId}")
268268

269269
assertEquals(HttpStatusCode.OK, response.status)
270270
assertEquals(ContentType.Text.Html.withCharset(Charsets.UTF_8), response.contentType())
@@ -295,7 +295,7 @@ class FeedbackEndpointsTest {
295295
module(TestDatabase.config())
296296
}
297297

298-
val response = client.get("/any-channel/thank-you")
298+
val response = client.get("/session/any-channel/thank-you")
299299

300300
assertEquals(HttpStatusCode.OK, response.status)
301301
assertEquals(ContentType.Text.Html.withCharset(Charsets.UTF_8), response.contentType())
@@ -354,7 +354,7 @@ class FeedbackEndpointsTest {
354354
)
355355
}.body<FeedbackChannelDTO>()
356356

357-
val body = client.get("/${channel.channelId}").bodyAsText()
357+
val body = client.get("/session/${channel.channelId}").bodyAsText()
358358

359359
// Each rating category should have a fieldset with 5 radio inputs
360360
for (category in channel.ratingCategories) {

0 commit comments

Comments
 (0)