Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reverse link results are not typed #1524

Open
kostasb opened this issue Jul 3, 2024 · 1 comment
Open

Reverse link results are not typed #1524

kostasb opened this issue Jul 3, 2024 · 1 comment
Labels
bug Something isn't working needs-triage

Comments

@kostasb
Copy link
Contributor

kostasb commented Jul 3, 2024

Reported on client version: 0.29.5

When aliasing a reverse link result with as, the alias is not typed in the returned object.

const record = await xata.db.ShoppingCarts.select([{
    name: "<-ShoppingCartLineItems.shoppingCart",
    columns: ["productId", "quantity", "type"],
    as: "lineItems"
}]).getFirst();

image

@kostasb kostasb added the bug Something isn't working label Jul 3, 2024
@kostasb
Copy link
Contributor Author

kostasb commented Jul 3, 2024

The same type issue applies not just to aliased but to the reverse linked table records

const record = await xata.db.ShoppingCarts.select([
    {
        name: "<-ShoppingCartLineItems.shoppingCart",
        columns: ["productId", "quantity", "type"],
    },
]).getFirst();

console.log(record.<-lacks types);

anything under ShoppingCartLineItemsshoppingCart (included) is not typed.

raw record response sample:

{
  "ShoppingCartLineItemsshoppingCart": {
    "records": [
      {
        "id": "rec_cq2eqoejtvt7ohj3uh70",
        "productId": "pid1",
        "quantity": 1,
        "type": "item",
        "xata": {
          "createdAt": "2024-07-03T06:19:13.319792+00:00",
          "updatedAt": "2024-07-03T06:19:13.319792+00:00",
          "version": 0
        }
      }
    ]
  },
  "id": "rec_cq2eqjskrmoddioegtv0",
  "xata": {
    "createdAt": "2024-07-03T06:18:55.023Z",
    "updatedAt": "2024-07-03T06:18:55.023Z",
    "version": 0
  }
}

@kostasb kostasb changed the title Reverse link Aliases are not typed Reverse link results are not typed Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-triage
Projects
None yet
Development

No branches or pull requests

1 participant