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

Add handling for null earinings #92

Merged
merged 4 commits into from
May 3, 2024

Conversation

KevinJoiner
Copy link
Contributor

This PR fixes 3 related issues.

  1. Our schema has fields with type BigInt! which maps to the go type *BigInt if we return a nil value GQL returns the error the requested element is null which the schema does not allow.

  2. We had checks for TotalSum being 0, which prevented us from returning other relevant information, such as totalCount.

  3. Our SUM for calculating TotalTokens was adding cols that could be NULL. Unlike the SUM function if you call operators like + on NuLL they will always return NULL.

Copy link

linear bot commented Apr 30, 2024

@elffjs
Copy link
Member

elffjs commented Apr 30, 2024

I'm wondering whether we should be allowing null token amounts at all in that table or in the GraphQL. I feel like it doesn't add anything. What do you think?

internal/repositories/reward/rewards.go Outdated Show resolved Hide resolved
graph/rewards_test.go Show resolved Hide resolved
graph/rewards_test.go Outdated Show resolved Hide resolved
@KevinJoiner KevinJoiner force-pushed the feature/si-2575-rewards-graphql-error branch from 39f76f0 to dff61d4 Compare May 3, 2024 13:33
@KevinJoiner KevinJoiner merged commit 9e373cb into main May 3, 2024
2 checks passed
SELECT 'up SQL query';

ALTER TABLE rewards
ALTER COLUMN streak_earnings SET DEFAULT 0,
Copy link
Member

@elffjs elffjs May 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah crap I think you need to still do an UPDATE rewards …. Trying to patch this up.

@@ -0,0 +1,25 @@
-- +goose Up
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh one more thing—we try to name this sequentially. I think goose has a command that helps you do that.

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