diff --git a/ArModelData.json b/ArModelData.json index 6c2b035..f5fe0ba 100644 --- a/ArModelData.json +++ b/ArModelData.json @@ -287,17 +287,12 @@ }, "modelData": { "material": { - "_id": "6464410c9c67517fcbccf447", + "_id": "6465a6e2f5c86b7c50520486", "ownerId": "646435a39c67517fcbccf426", - "name": "奸笑的綿芽", - "path": "/upload/1684291852002.jpeg", - "contentType": "image/jpeg", - "fileTag": [ - "圖片", - "Hololive" - ], - "createAt": 1684291852023, - "updatedAt": 1684294290879 + "name": "獅子影片", + "path": "/upload/1684383458922.mp4", + "contentType": "video/mp4", + "createAt": 1684383458939 }, "params": { "availableRange": 20, @@ -336,17 +331,12 @@ }, "modelData": { "material": { - "_id": "6464410c9c67517fcbccf447", + "_id": "6465a6e2f5c86b7c50520486", "ownerId": "646435a39c67517fcbccf426", - "name": "奸笑的綿芽", - "path": "/upload/1684291852002.jpeg", - "contentType": "image/jpeg", - "fileTag": [ - "圖片", - "Hololive" - ], - "createAt": 1684291852023, - "updatedAt": 1684294290879 + "name": "獅子影片", + "path": "/upload/1684383458922.mp4", + "contentType": "video/mp4", + "createAt": 1684383458939 }, "params": { "availableRange": 20, diff --git a/src/main/kotlin/com/ray650128/plugins/ArModelRouting.kt b/src/main/kotlin/com/ray650128/plugins/ArModelRouting.kt index d879338..f41d53f 100644 --- a/src/main/kotlin/com/ray650128/plugins/ArModelRouting.kt +++ b/src/main/kotlin/com/ray650128/plugins/ArModelRouting.kt @@ -35,6 +35,19 @@ fun Application.configureArModelRouting() { call.sendSuccess(list) } + get("/{id}") { + call.authentication.principal()?.account ?: run { + call.sendUnauthorized() + return@get + } + val id = call.parameters["id"].toString() + val arModel = modelService.findById(id) ?: run { + call.sendNotFound() + return@get + } + call.sendSuccess(arModel.toDto()) + } + post("/create") { val user = call.authentication.principal() ?: run { call.sendUnauthorized()