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

api: Query isHealthy field as a string to handle JSOnull #2143

Merged
merged 2 commits into from
Apr 23, 2024

Conversation

victorges
Copy link
Member

@victorges victorges commented Apr 22, 2024

What does this pull request do? Explain your changes. (required)

This fixes the isHealthy filter on streams list so we don't get this error:
cannot cast jsonb null to type boolean

This happened not when the field was not set, in which case data->'isHealthy' returns
a SQL NULL but when the field was actually set to a JSON null value, which is
sometimes done here.

Postgres supports converting NULL to boolean, but not jsonb null to boolean, which
is when the query exploded. This fixes it by querying the field as TEXT (->>) instead,
which automatically converts jsonb null to a SQL NULL as well and everything works.

Also added a little validation that was missing in parseFilters.

Specific updates (required)

  • Change isHealthy field query to ->> instead of ->
  • Add validation for boolean filters on parseFilters

How did you test each of these updates (required)
Ran queries on Postgres DB.

Does this pull request close any open issues?
https://discord.com/channels/423160867534929930/611650333243867170/1231996105433157632

Checklist

  • I have read the CONTRIBUTING document.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.

@victorges victorges requested a review from a team as a code owner April 22, 2024 16:58
Copy link

vercel bot commented Apr 22, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
livepeer-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 22, 2024 5:05pm

@suhailkakar suhailkakar merged commit 1539353 into master Apr 23, 2024
13 checks passed
@suhailkakar suhailkakar deleted the vg/fix-is-healthy-filter branch April 23, 2024 18:15
suhailkakar added a commit that referenced this pull request Apr 24, 2024
* Stick to the pull host while triggering the catalyst pull start (#2138)

* Revert "Stick to the pull host while triggering the catalyst pull start (#2138)" (#2141)

This reverts commit 29ad25a.

* Stick to the pull host while triggering the catalyst pull start (#2142)

* api: ingest: direct base & playback (#2139)

* api: ingest: direct base & playback

* fix

* fix

* implement for a specific hardcoded id for tests

* fix

* fix

* api: Handle active cleanup from pull lock API (#2144)

* refactor: improve api schema (#2109)

* format yaml

* add operationId to all endpoints

* marked rooms api as deprecated

* add tags to each endpoints

* moved unused components to db-schema

* add examples

* override name for sdk generation

* override operation name for sdk generatino

* run prettier & fix typo

* Update packages/api/src/schema/api-schema.yaml

Co-authored-by: Victor Elias <victor@livepeer.org>

* Update packages/api/src/schema/api-schema.yaml

Co-authored-by: Victor Elias <victor@livepeer.org>

* Update packages/api/src/schema/api-schema.yaml

Co-authored-by: Victor Elias <victor@livepeer.org>

* Update api-schema.yaml

* fix: build error

* revert: add new-asset-from-url-payload to api-schema.yaml

* Update api-schema.yaml

* fix build issue

* hardcoded inputcreator filter

* fix: create stream and loosening schema (#2134)

* Update compile-schemas.js

* fix: tsconfig

* fix: revert additionalproperties

* fix: remove InputCreatorId unknown

* fix: api schema

* fix: api schema

* fix: revert changes to additional properties

* fix: fixes from review

* fix: lint

---------

Co-authored-by: Victor Elias <victor@livepeer.org>
Co-authored-by: Chase Adams <c@cadams.io>

* api: Query isHealthy field as a string to handle JSOnull (#2143)

* api: Query isHealthy field as a string to handle JSOnull

* api: Add check on boolean fields filter value

* api: moved objectStoreId and catalystPipelineStrategy to db schema (#2146)

* api: moved params to db schema

* Update db-schema.yaml

* remove url

* api: fix direct playback api (#2147)

* fix june trigger (#2145)

* fix sending track multiple times

* add missing imports

* replace track with page method

---------

Co-authored-by: Rafał Leszko <rafal@livepeer.org>
Co-authored-by: gioelecerati <50955448+gioelecerati@users.noreply.github.com>
Co-authored-by: Victor Elias <victor@livepeer.org>
Co-authored-by: Chase Adams <c@cadams.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants