Compare commits
3 Commits
77a1690e08
...
44601131a2
| Author | SHA1 | Date | |
|---|---|---|---|
| 44601131a2 | |||
| 6fb1c9fb2e | |||
| e5f4f423f4 |
+1
-1
@@ -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 . .
|
||||||
|
|||||||
+4
-3
@@ -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,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
|
||||||
|
|||||||
Reference in New Issue
Block a user