Skip to content
New issue

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

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

Already on GitHub? # to your account

fix: always set ticket expires at as it can't be null #588

Merged
merged 1 commit into from
Nov 26, 2024

Conversation

dbarrosop
Copy link
Member

@dbarrosop dbarrosop commented Nov 26, 2024

Fixes nhost/nhost#3035

PR Type

Bug fix


Description

  • Updated TicketExpiresAt field in multiple test cases to use sql.TimestampTz(time.Now()) ensuring it is always set to a non-null value.
  • Modified ticketExpiresAt initialization in #UserWithouthSession method to ensure it is always set to a non-null value.

Changes walkthrough 📝

Relevant files
Bug fix
post_signin_idtoken_test.go
Set non-null `TicketExpiresAt` in test cases                         

go/controller/post_signin_idtoken_test.go

  • Updated TicketExpiresAt field to use sql.TimestampTz(time.Now())
    instead of pgtype.Timestamptz{}.
  • Ensured TicketExpiresAt is always set to a non-null value in test
    cases.
  • +4/-4     
    workflows.go
    Ensure `ticketExpiresAt` is non-null during user #   

    go/controller/workflows.go

  • Changed ticketExpiresAt initialization to use
    sql.TimestampTz(time.Now()).
  • Ensured ticketExpiresAt is always set to a non-null value.
  • +1/-1     

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    Copy link
    Contributor

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 PR contains tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Possible Bug
    Ensure that sql.TimestampTz(time.Now()) correctly initializes TicketExpiresAt and does not introduce any unintended side effects, especially considering time zone differences and precision.

    Code Smell
    The initialization of ticketExpiresAt with sql.TimestampTz(time.Now()) is duplicated. Consider refactoring to avoid redundancy and improve maintainability.

    Copy link
    Contributor

    PR Code Suggestions ✨

    @dbarrosop dbarrosop merged commit f1f4ae2 into main Nov 26, 2024
    11 checks passed
    @dbarrosop dbarrosop deleted the set-ticket-expires-at branch November 26, 2024 14:51
    # for free to join this conversation on GitHub. Already have an account? # to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    Error occurs while sign-up using IdToken (Google One Tab SignIn)
    2 participants