diff --git a/buildSrc/src/main/kotlin/Config.kt b/buildSrc/src/main/kotlin/Config.kt index f4790922..07667126 100644 --- a/buildSrc/src/main/kotlin/Config.kt +++ b/buildSrc/src/main/kotlin/Config.kt @@ -3,9 +3,9 @@ import org.gradle.api.JavaVersion object Config { const val tachideskVersion = "v0.4.7" // Bump this when updating the Tachidesk version or Preview commit - const val serverCode = 809 + const val serverCode = 842 const val preview = true - const val previewCommit = "b31f2d50f6ed03aa900986536d90b4aa9a9417d4" + const val previewCommit = "a8ef6cdd4f10eaf0d265fc8a422fdd9bc4a28cfd" val jvmTarget = JavaVersion.VERSION_15 } \ No newline at end of file diff --git a/src/main/kotlin/ca/gosyer/data/server/interactions/CategoryInteractionHandler.kt b/src/main/kotlin/ca/gosyer/data/server/interactions/CategoryInteractionHandler.kt index b3965c59..e976b09d 100644 --- a/src/main/kotlin/ca/gosyer/data/server/interactions/CategoryInteractionHandler.kt +++ b/src/main/kotlin/ca/gosyer/data/server/interactions/CategoryInteractionHandler.kt @@ -95,9 +95,9 @@ class CategoryInteractionHandler @Inject constructor( } suspend fun modifyCategory(category: Category, name: String? = null, isLanding: Boolean? = null) = modifyCategory(category.id, name, isLanding) - suspend fun reorderCategory(categoryId: Long, to: Int, from: Int) = withIOContext { + suspend fun reorderCategory(to: Int, from: Int) = withIOContext { client.submitForm( - serverUrl + categoryReorderRequest(categoryId), + serverUrl + categoryReorderRequest(), formParameters = Parameters.build { append("to", to.toString()) append("from", from.toString()) @@ -106,7 +106,6 @@ class CategoryInteractionHandler @Inject constructor( method = HttpMethod.Patch } } - suspend fun reorderCategory(category: Category, to: Int, from: Int) = reorderCategory(category.id, to, from) suspend fun deleteCategory(categoryId: Long) = withIOContext { client.delete( diff --git a/src/main/kotlin/ca/gosyer/data/server/requests/Category.kt b/src/main/kotlin/ca/gosyer/data/server/requests/Category.kt index af15d8a9..37a4c2b8 100644 --- a/src/main/kotlin/ca/gosyer/data/server/requests/Category.kt +++ b/src/main/kotlin/ca/gosyer/data/server/requests/Category.kt @@ -34,8 +34,8 @@ fun categoryModifyRequest(categoryId: Long) = "/api/v1/category/$categoryId" @Patch -fun categoryReorderRequest(categoryId: Long) = - "/api/v1/category/$categoryId/reorder" +fun categoryReorderRequest() = + "/api/v1/category/reorder" @Delete fun categoryDeleteRequest(categoryId: Long) = diff --git a/src/main/kotlin/ca/gosyer/ui/categories/CategoriesMenuViewModel.kt b/src/main/kotlin/ca/gosyer/ui/categories/CategoriesMenuViewModel.kt index b3370ea5..9e3f2b4b 100644 --- a/src/main/kotlin/ca/gosyer/ui/categories/CategoriesMenuViewModel.kt +++ b/src/main/kotlin/ca/gosyer/ui/categories/CategoriesMenuViewModel.kt @@ -66,7 +66,7 @@ class CategoriesMenuViewModel @Inject constructor( val updatedCategory = updatedCategories.find { it.id == category.id || it.name == category.name } ?: return@forEach if (category.order != updatedCategory.order) { debug { "${category.name}: ${updatedCategory.order} to ${category.order}" } - categoryHandler.reorderCategory(updatedCategory, category.order, updatedCategory.order) + categoryHandler.reorderCategory(category.order, updatedCategory.order) } updatedCategories = categoryHandler.getCategories(true) }