@@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.*
12
12
import java.util.*
13
13
14
14
@RestController
15
+ @RequestMapping(" /documents" )
15
16
class DocumentController (
16
17
private val documentService : DocumentService ,
17
18
private val commentService : CommentService
@@ -22,21 +23,21 @@ class DocumentController(
22
23
private val logger = getLogger(javaClass.enclosingClass)
23
24
}
24
25
25
- @PostMapping(" /documents " )
26
+ @PostMapping(" /" )
26
27
fun createDocument (
27
28
@RequestBody json : String
28
29
): DocumentView {
29
30
logger.debug(" createDocument: received json: {}" , json)
30
31
return mapToDocumentView(documentService.createDocument(json))
31
32
}
32
33
33
- @GetMapping(" /documents/ {documentId}" )
34
+ @GetMapping(" /{documentId}" )
34
35
fun getDocument (@PathVariable(" documentId" ) documentId : UUID ): DocumentView {
35
36
logger.debug(" getDocument" )
36
37
return mapToDocumentView(documentService.getDocument(documentId))
37
38
}
38
39
39
- @PostMapping(" /documents/ {documentId}/comments" )
40
+ @PostMapping(" /{documentId}/comments" )
40
41
fun createComment (
41
42
@PathVariable(" documentId" ) documentId : UUID ,
42
43
@RequestBody commentInput : CommentInput
@@ -52,15 +53,15 @@ class DocumentController(
52
53
)
53
54
}
54
55
55
- @GetMapping(" /documents/ {documentId}/comments" )
56
+ @GetMapping(" /{documentId}/comments" )
56
57
fun getAllCommentsWithPossibleThreads (
57
58
@PathVariable(" documentId" ) documentId : UUID
58
59
): List <CommentView > {
59
60
logger.debug(" getAllCommentsWithPossibleThreads" )
60
61
return commentService.getComments(documentId).map { mapCommentToView(it) }
61
62
}
62
63
63
- @PostMapping(" /documents/ {documentId}/comments/{commentId}" )
64
+ @PostMapping(" /{documentId}/comments/{commentId}" )
64
65
fun replyToComment (
65
66
@PathVariable(" documentId" ) documentId : UUID ,
66
67
@PathVariable(" commentId" ) commentId : UUID ,
@@ -78,7 +79,7 @@ class DocumentController(
78
79
)
79
80
}
80
81
81
- @GetMapping(" /documents/ {documentId}/comments/{commentId}" )
82
+ @GetMapping(" /{documentId}/comments/{commentId}" )
82
83
fun getCommentWithPossibleThread (
83
84
@PathVariable(" documentId" ) documentId : UUID ,
84
85
@PathVariable(" commentId" ) commentId : UUID
0 commit comments