Skip to content
Closed
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
3 changes: 0 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ dependencies {
implementation("com.zaxxer:HikariCP")
implementation("org.postgresql:postgresql")

implementation("io.micrometer:micrometer-registry-prometheus")
implementation("io.micrometer:micrometer-tracing-bridge-brave")

implementation("ch.qos.logback:logback-classic")
implementation("net.logstash.logback:logstash-logback-encoder:$logstashVersion")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.17.1")
Expand Down
10 changes: 5 additions & 5 deletions deploy/nais.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,17 @@ spec:
timeout: 1
resources:
limits:
memory: 1024Mi
memory: 2024Mi
requests:
cpu: 40m
memory: 256Mi
cpu: 80m
memory: 1024Mi
ingresses:
{{#each ingresses as |ingress|}}
- {{ingress}}
{{/each}}
replicas:
min: 2
max: 4
min: 1
max: 3
cpuThresholdPercentage: 80
prometheus:
enabled: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import no.nav.klage.document.api.views.DocumentVersionView
import no.nav.klage.document.api.views.DocumentView
import no.nav.klage.document.config.SecurityConfiguration.Companion.ISSUER_AAD
import no.nav.klage.document.domain.DocumentVersion
import no.nav.klage.document.domain.ShortDocumentVersion
import no.nav.klage.document.service.DocumentService
import no.nav.klage.document.util.TokenUtil
import no.nav.klage.document.util.getLogger
Expand Down Expand Up @@ -132,7 +133,7 @@ class DocumentController(
modified = documentVersion.modified
)

private fun mapToDocumentVersionView(documentVersion: DocumentVersion): DocumentVersionView =
private fun mapToDocumentVersionView(documentVersion: ShortDocumentVersion): DocumentVersionView =
DocumentVersionView(
documentId = documentVersion.documentId,
version = documentVersion.version,
Expand Down
36 changes: 0 additions & 36 deletions src/main/kotlin/no/nav/klage/document/config/CustomTraceFilter.kt

This file was deleted.

13 changes: 12 additions & 1 deletion src/main/kotlin/no/nav/klage/document/domain/DocumentVersion.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,16 @@ class DocumentVersion(
return "DocumentVersion(documentId=$documentId, version=$version, json='$json', data=$data, created=$created, modified=$modified, authorNavIdent='$authorNavIdent')"
}


}

/**
* Using this when we don't need the full DocumentVersion object, just a subset of the fields.
* Otherwise, we would have to fetch the full object from the database and that's too much data.
*/
data class ShortDocumentVersion(
val documentId: UUID,
val version: Int,
val authorNavIdent: String,
val created: LocalDateTime,
val modified: LocalDateTime,
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,24 @@ package no.nav.klage.document.repositories

import no.nav.klage.document.domain.DocumentVersion
import no.nav.klage.document.domain.DocumentVersionId
import no.nav.klage.document.domain.ShortDocumentVersion
import org.springframework.data.jpa.repository.JpaRepository
import org.springframework.data.jpa.repository.Query
import java.util.*

interface DocumentVersionRepository : JpaRepository<DocumentVersion, DocumentVersionId> {

fun findByDocumentId(documentId: UUID): List<DocumentVersion>

@Query(
"""
SELECT new no.nav.klage.document.domain.ShortDocumentVersion(documentId, version, authorNavIdent, created, modified)
FROM DocumentVersion
WHERE documentId = :documentId
ORDER BY version
"""
)
fun findVersionsByDocumentId(documentId: UUID): List<ShortDocumentVersion>

fun deleteByDocumentId(documentId: UUID)
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package no.nav.klage.document.service
import no.nav.klage.document.domain.Document
import no.nav.klage.document.domain.DocumentVersion
import no.nav.klage.document.domain.DocumentVersionId
import no.nav.klage.document.domain.ShortDocumentVersion
import no.nav.klage.document.repositories.CommentRepository
import no.nav.klage.document.repositories.DocumentRepository
import no.nav.klage.document.repositories.DocumentVersionRepository
Expand Down Expand Up @@ -113,8 +114,8 @@ class DocumentService(
documentRepository.deleteById(documentId)
}

fun getDocumentVersions(documentId: UUID): List<DocumentVersion> {
return documentVersionRepository.findByDocumentId(documentId = documentId).sortedBy { it.version }
fun getDocumentVersions(documentId: UUID): List<ShortDocumentVersion> {
return documentVersionRepository.findVersionsByDocumentId(documentId = documentId)
}

}
17 changes: 1 addition & 16 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@ spring:
name: kabal-smart-editor-api
main:
banner-mode: OFF
sleuth:
baggage:
remote-fields:
- Nav-Callid
- Nav-Consumer-Id
correlation-fields:
- Nav-Callid
- Nav-Consumer-Id
mvc:
throw-exception-if-no-handler-found: true
lifecycle:
Expand Down Expand Up @@ -44,8 +36,6 @@ server:
enabled: false
shutdown: graceful

navCallIdName: Nav-Callid

management:
endpoint:
health:
Expand All @@ -62,12 +52,7 @@ management:
export:
enabled: true
tracing:
baggage:
remote-fields:
- ${navCallIdName}
correlation:
fields:
- ${navCallIdName}
enabled: false

no.nav.security.jwt:
issuer:
Expand Down