supabase-community / postgrest-csharp

A C# Client library for Postgrest
https://supabase-community.github.io/postgrest-csharp/api/Postgrest.html
MIT License
114 stars 22 forks source link

Ordering not working #6

Closed elrhomariyounes closed 3 years ago

elrhomariyounes commented 3 years ago

Bug report

Describe the bug

Hello, a RequestException is thrown when trying to perform an order request on a table. After debugging I found out that the Postgrest was returning a Bad Request (400) because the GenerateUrl method in the Builder was generating an URL not corresponding to the expected one by Postgrest.

The issue was caused by the Enum Ordering the value was not mapped. The expected URL /table?order=column.desc.nullsfirst, the generated url by the method is /table?order=column.Descending.nullsfirst

Expected values from Postgrest are asc and desc.

I fixed the issue by mapping the ordering enum value and add it to the query. I submitted a PR :relaxed:

Thank you very much.

To Reproduce

Expected behavior

System information

-OS: [Windows 10 Pro 1909] -.Net core 3.1.x -Visual Studio 16.8 -Version of supabase-postgrest-csharp: master branch of current repo