upleveled / next-js-example-fall-2023-atvie

https://next-js-example-fall-2023-vienna-austria.fly.dev/
2 stars 2 forks source link

Upgrade to SafeQL 3.0 beta, remove JsonAgg type #16

Open karlhorky opened 11 months ago

karlhorky commented 11 months ago

The SafeQL 3.0.0 beta includes support for some json_ functions in queries:

karlhorky commented 11 months ago

Currently failing from the @ts-safeql/eslint-plugin@3.0.0-next.1 package problems:

karlhorky commented 11 months ago

Maybe the subselect isn't supported yet

cc @Eprince-hub

Newbie012 commented 11 months ago

Try 3.0.0.next-3

However, the subselect would probably not work.

karlhorky commented 11 months ago

Right ok, now with @ts-safeql/eslint-plugin@3.0.0-next.3 we're back to the Food[] vs JsonAgg error message:

Query has incorrect type annotation.
    Expected: { animalId: number; animalFirstName: string; animalType: string; animalAccessory: null | string; animalFoods: null | Food[] }[]
    Actual: { animalId: number; animalFirstName: string; animalType: string; animalAccessory: string | null; animalFoods: JsonAgg | null }[]

Commits:

  1. Upgrade to @ts-safeql/eslint-plugin@3.0.0-next.3 f005cdd
  2. Switch back to JsonAgg 571ac09

cc @Eprince-hub

karlhorky commented 11 months ago

I'll leave this open until the final @ts-safeql/eslint-plugin@3.0.0 version is released, to see if there are any further improvements which could enable us to remove the JsonAgg type.

karlhorky commented 10 months ago

Upgraded to @ts-safeql/eslint-plugin@3.0.0-next.4 and there appear to be improvements: the getAnimalWithFoodsById query doesn't require JsonAgg anymore.

But there are other issues with null fields / properties:

karlhorky commented 6 months ago

Tried @ts-safeql/eslint-plugin@3.0.1 just now, and we're still at the null values in the SafeQL fields when using json_agg() with a LEFT JOIN: