Fix lint error - #7
Merged
Merged
Conversation
…efactor auth handlers for improved clarity
…ved maintainability; update context usage in response service
…nhance migration and file upload processes
… across multiple files
…d improve type consistency; enhance error handling in database initialization
…res to use pointers for improved consistency; streamline migration command flags and response handling
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces several improvements and refactorings across the authentication, configuration, database, migration, and CI/CD workflow areas of the codebase. The main highlights are a significant refactor of the Google OAuth login flow for clarity and maintainability, improved error handling and logging, modularization of Echo middleware and route setup, and enhanced migration tooling. Additionally, the CI workflow now includes a linting step before build. Below are the most important changes grouped by theme:
Authentication and OAuth Refactor:
internal/auth/google_login.goto extract logic into helper methods (getUserOrCreateFromOAuth,updateUserOAuthTokens,linkExistingUserToOAuth,createNewOAuthUser), improving readability and maintainability. Also introduced agoogleProviderconstant and updated token/cookie handling.internal/auth/providers.goandinternal/auth/service.go.API Server Structure and Error Handling:
cmd/api/main.goby moving middleware and route setup tosetupMiddlewareandsetupRoutesfunctions. Improved error handling by logging errors and returning early instead of panicking or callinglog.Fatal.Migration Tooling:
cmd/migrate/main.goto use structured logging (zap), modularized migration command execution into separate functions (runUp,runDown, etc.), and improved resource cleanup with deferred closures and error handling.Codebase Documentation and Linting:
internal/auth/google_login.go,internal/config/config.go, andinternal/database/connection.gofor improved code clarity and maintainability.lintjob to the GitHub Actions workflow (.github/workflows/go.yml) to ensure code quality before building.Minor Cleanups: