fix: honour tenancy when updating.

This commit is contained in:
James Harton 2023-10-02 15:36:28 +13:00
parent 176b6bf0aa
commit 5470268810
Signed by: james
GPG key ID: 90E82DAA13F624F4

View file

@ -126,6 +126,7 @@ defmodule AshCubDB.DataLayer do
{:ok, db} <- start(resource),
{:ok, record} <- Changeset.apply_attributes(changeset),
{:ok, key, data} <- Serde.serialise(record),
{:ok, key} <- maybe_wrap_in_tenant(key, changeset),
true <- CubDB.has_key?(db, key),
:ok <- CubDB.put(db, key, data) do
{:ok, set_loaded(record)}