From 07af1f7013ef7c2d23034c27c8793d1f97cf1dd4 Mon Sep 17 00:00:00 2001 From: Jan Date: Sat, 2 Mar 2024 14:08:52 +0100 Subject: [PATCH 1/4] Fix ordering by multiple columns --- .../jan/supabase/postgrest/query/PostgrestRequestBuilder.kt | 2 ++ gradle.properties | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Postgrest/src/commonMain/kotlin/io/github/jan/supabase/postgrest/query/PostgrestRequestBuilder.kt b/Postgrest/src/commonMain/kotlin/io/github/jan/supabase/postgrest/query/PostgrestRequestBuilder.kt index 13b27412..97881356 100644 --- a/Postgrest/src/commonMain/kotlin/io/github/jan/supabase/postgrest/query/PostgrestRequestBuilder.kt +++ b/Postgrest/src/commonMain/kotlin/io/github/jan/supabase/postgrest/query/PostgrestRequestBuilder.kt @@ -68,6 +68,8 @@ class PostgrestRequestBuilder(@PublishedApi internal val propertyConversionMetho */ fun order(column: String, order: Order, nullsFirst: Boolean = false, referencedTable: String? = null) { val key = if (referencedTable == null) "order" else "$referencedTable.order" + val existingOrder = _params[key]?.firstOrNull() ?: "" + val newOrder = "$existingOrder,${column}.${order.value}.${if (nullsFirst) "nullsfirst" else "nullslast"}" _params[key] = listOf("${column}.${order.value}.${if (nullsFirst) "nullsfirst" else "nullslast"}") } diff --git a/gradle.properties b/gradle.properties index e3d6147e..3ba1dfeb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,4 +10,4 @@ kotlin.experimental.tryK2=false org.jetbrains.compose.experimental.uikit.enabled=true org.jetbrains.compose.experimental.jscanvas.enabled=true -supabase-version = 2.1.5 +supabase-version = 2.1.6-dev From c4284d0fe8c221780dd8b53b67052f573ff1352e Mon Sep 17 00:00:00 2001 From: Jan Date: Sat, 2 Mar 2024 14:14:25 +0100 Subject: [PATCH 2/4] Update versions --- gradle/libs.versions.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 844af259..afc3e734 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -22,10 +22,10 @@ moshi = "1.15.1" jackson = "2.16.1" browser = "1.7.0" googleid = "1.1.0" -compose = "1.5.12" +compose = "1.6.0" androidsvg = "1.4" -coil = "2.5.0" -imageloader = "1.7.5" +coil = "2.6.0" +imageloader = "1.7.6" okio = "3.8.0" credentials = "1.2.0" From 4bf23c3701c753ab93fca1734a1fa2760e06047c Mon Sep 17 00:00:00 2001 From: Jan Date: Sat, 2 Mar 2024 14:18:51 +0100 Subject: [PATCH 3/4] actually use the new fix --- .../supabase/postgrest/query/PostgrestRequestBuilder.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Postgrest/src/commonMain/kotlin/io/github/jan/supabase/postgrest/query/PostgrestRequestBuilder.kt b/Postgrest/src/commonMain/kotlin/io/github/jan/supabase/postgrest/query/PostgrestRequestBuilder.kt index 97881356..7c0c0125 100644 --- a/Postgrest/src/commonMain/kotlin/io/github/jan/supabase/postgrest/query/PostgrestRequestBuilder.kt +++ b/Postgrest/src/commonMain/kotlin/io/github/jan/supabase/postgrest/query/PostgrestRequestBuilder.kt @@ -68,9 +68,10 @@ class PostgrestRequestBuilder(@PublishedApi internal val propertyConversionMetho */ fun order(column: String, order: Order, nullsFirst: Boolean = false, referencedTable: String? = null) { val key = if (referencedTable == null) "order" else "$referencedTable.order" - val existingOrder = _params[key]?.firstOrNull() ?: "" - val newOrder = "$existingOrder,${column}.${order.value}.${if (nullsFirst) "nullsfirst" else "nullslast"}" - _params[key] = listOf("${column}.${order.value}.${if (nullsFirst) "nullsfirst" else "nullslast"}") + val orderEntry = _params[key]?.firstOrNull() + val existingOrder = if (orderEntry == null) "" else "$orderEntry," + val newOrder = "$existingOrder${column}.${order.value}.${if (nullsFirst) "nullsfirst" else "nullslast"}" + _params[key] = listOf(newOrder) } /** From 1a022ccae5af712c4c4e9c2ed171c6d1342290a7 Mon Sep 17 00:00:00 2001 From: Jan Date: Sun, 3 Mar 2024 11:32:45 +0100 Subject: [PATCH 4/4] Update version --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 3ba1dfeb..6b9a40ab 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,4 +10,4 @@ kotlin.experimental.tryK2=false org.jetbrains.compose.experimental.uikit.enabled=true org.jetbrains.compose.experimental.jscanvas.enabled=true -supabase-version = 2.1.6-dev +supabase-version = 2.1.6