Skip to content
Open
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 @@ -45,20 +45,17 @@ fun Route.feedbackChannelRoutes(

val feedbackInput = call.receive<FeedbackCreationDTO>()

application.log.info("Feedback received on ${clock.instant()}: $feedbackInput \n\n ${call.request.headers}")


val createdFeedback = try {
feedbackAdapter.submitFeedback(
channelId = channelId,
feedback = feedbackInput.toDomain(),
now = clock.instant(),
)
} catch (e: ChannelNotFoundError) {
application.log.error("Failed with id $channelId not found")
application.log.info("Channel not found: ${e.message}")
return@post call.respond(HttpStatusCode.NotFound, e.message)
} catch (e: ChannelClosedError) {
application.log.error("Failed with id $channelId closed")
application.log.info("Channel closed: ${e.message}")
return@post call.respond(HttpStatusCode.Forbidden, e.message)
}

Expand All @@ -83,7 +80,7 @@ fun Route.feedbackChannelRoutes(
},
)
}

application.log.info("Created feedback with id: ${feedbackDto.id}")
call.respond(feedbackDto)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@ import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.api.BeforeAll
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test
import java.util.*

@Disabled
class FeedbackEndpointsTest {
companion object {
private const val ADMIN_USER = "test-admin"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,7 @@ class FeedbackChannel(
}

fun isEffectivelyOpen(now: Instant): Boolean =
true
isOpen &&
(opensAt == null || !now.isBefore(opensAt)) &&
(closesAt == null || now.isBefore(closesAt))
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ package no.javazone.feedback.domain
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Assertions.assertFalse
import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.assertThrows
import java.time.Instant

@Disabled
class FeedbackChannelTest {
private val ratings = listOf(FeedbackChannelRatingCategory(id = 1, name = "Content"))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@ import no.javazone.feedback.domain.FeedbackRating
import no.javazone.feedback.domain.errors.ChannelClosedError
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Assertions.assertNotNull
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.assertThrows
import java.time.Instant

@Disabled
class FeedbackAdapterTest {

private val defaultInput = FeedbackChannelCreationInput(
Expand Down