@palbase/backend 39.0.0 → 39.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -4456,12 +4456,13 @@ __name(sqlFragment, "sqlFragment");
4456
4456
  // src/db/repository.ts
4457
4457
  function defineRepository(table, opts) {
4458
4458
  const tenantColumn = opts.tenant;
4459
+ const rowKey = opts.key ?? "id";
4459
4460
  const scope = /* @__PURE__ */ __name((tenant) => ({
4460
4461
  [tenantColumn]: tenant
4461
4462
  }), "scope");
4462
4463
  const scopeRow = /* @__PURE__ */ __name((tenant, id) => ({
4463
4464
  [tenantColumn]: tenant,
4464
- id
4465
+ [rowKey]: id
4465
4466
  }), "scopeRow");
4466
4467
  const scopedPayload = /* @__PURE__ */ __name((values, tenant) => ({
4467
4468
  ...values,
@@ -4489,7 +4490,7 @@ function defineRepository(table, opts) {
4489
4490
  async update(tenant, id, patch) {
4490
4491
  const row = await this.updateScoped(tenant, id, patch);
4491
4492
  if (row === null) {
4492
- throw new NotFound(`${String(tenantColumn)}=${String(tenant)} kapsam\u0131nda ${id} bulunamad\u0131`);
4493
+ throw new NotFound(`${String(tenantColumn)}=${String(tenant)} kapsam\u0131nda ${rowKey}=${String(id)} bulunamad\u0131`);
4493
4494
  }
4494
4495
  return row;
4495
4496
  }