File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed
src/main/kotlin/no/nav/klage/document Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,19 @@ class DocumentController(
38
38
return mapToDocumentView(documentService.createDocument(json))
39
39
}
40
40
41
+ @ApiOperation(
42
+ value = " Update document" ,
43
+ notes = " Update document"
44
+ )
45
+ @PutMapping(" /{documentId}" )
46
+ fun updateDocument (
47
+ @PathVariable(" documentId" ) documentId : UUID ,
48
+ @RequestBody json : String
49
+ ): DocumentView {
50
+ logger.debug(" updateDocument: received json: {}" , json)
51
+ return mapToDocumentView(documentService.updateDocument(documentId, json))
52
+ }
53
+
41
54
@ApiOperation(
42
55
value = " Get document" ,
43
56
notes = " Get document"
Original file line number Diff line number Diff line change @@ -22,6 +22,13 @@ class DocumentService(private val documentRepository: DocumentRepository) {
22
22
)
23
23
}
24
24
25
+ fun updateDocument (documentId : UUID , json : String ): Document {
26
+ val document = documentRepository.getById(documentId)
27
+ document.json = json
28
+ document.modified = LocalDateTime .now()
29
+ return document
30
+ }
31
+
25
32
fun getDocument (documentId : UUID ): Document {
26
33
return documentRepository.getById(documentId)
27
34
}
You can’t perform that action at this time.
0 commit comments