supabase-community / postgrest-csharp

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

Update a record not working #2

Closed elrhomariyounes closed 4 years ago

elrhomariyounes commented 4 years ago

Bug report

Describe the bug

Thank you.

To Reproduce

  1. Retrieve a user
    var user= await client.Builder<User>().Filter("username", Postgrest.Constants.Operator.Equals, "supabot").Single();
  2. Update if not null
    user.Status = "OFFLINE";
    await user.Update<User>();
  3. To reproduce second case (Not Found user)
    var user = new User
    {
    Username = "ghost",
    Status = "ONLINE"
    };
    await client.Builder<User>().Update(user);

    Expected behavior

  4. User updated if not null
  5. When trying to update a not existing user a RequestException to be thrown instead of JsonSerializationException

System information

acupofjose commented 4 years ago

Expected Behavior #2 is fixed in commit f51d8a6c

Thanks again for a detailed bug report and a PR!