Compare commits

...

3 Commits

Author SHA1 Message Date
ray650128 44601131a2 修正新增出刀紀錄回傳結果 2026-08-06 21:00:52 +08:00
ray650128 6fb1c9fb2e 修正port 2026-08-06 21:00:28 +08:00
ray650128 e5f4f423f4 修正依賴 2026-08-06 21:00:17 +08:00
3 changed files with 6 additions and 5 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
# 使用 Kotlin + JDK 的輕量化映像 # 使用 Kotlin + JDK 的輕量化映像
FROM gradle:9-jdk25-alpine-dev AS builder FROM gradle:9.5.1-jdk25 AS builder
WORKDIR /app WORKDIR /app
COPY . . COPY . .
@@ -18,10 +18,10 @@ class BattleRecordService(private val database: MongoDatabase) {
} }
// Create new car // Create new car
suspend fun create(data: BattleRecordDto): String = withContext(Dispatchers.IO) { suspend fun create(data: BattleRecordDto): BattleRecordDto = withContext(Dispatchers.IO) {
val doc = data.toDocument() val doc = data.toDocument()
collection.insertOne(doc) collection.insertOne(doc)
doc["uid"].toString() doc.let(BattleRecordDto::fromDocument)
} }
// Read a car // Read a car
@@ -39,12 +39,13 @@ class BattleRecordService(private val database: MongoDatabase) {
} }
// Update a car // Update a car
suspend fun update(date: String, data: BattleRecordDto): Document? = withContext(Dispatchers.IO) { suspend fun update(date: String, data: BattleRecordDto): BattleRecordDto? = withContext(Dispatchers.IO) {
val filter = and( val filter = and(
Filters.eq("date", date), Filters.eq("date", date),
Filters.eq("uid", data.uid) Filters.eq("uid", data.uid)
) )
collection.findOneAndReplace(filter, data.toDocument()) collection.findOneAndReplace(filter, data.toDocument())
collection.find(filter).first()?.let(BattleRecordDto::fromDocument)
} }
// Delete a car // Delete a car
+1 -1
View File
@@ -1,6 +1,6 @@
ktor: ktor:
deployment: deployment:
port: 8080 port: 10001
application: application:
modules: modules:
- club.sakunadaisuki.pcrediveclanrecordbackend.plugins.HttpKt.configureHttp - club.sakunadaisuki.pcrediveclanrecordbackend.plugins.HttpKt.configureHttp