Merged
Conversation
fix auth api swagger
Introduces an is_active boolean column to the applications table with a migration, updates the Application model with an active scope and proper casting, and refactors ApplicationController to support activation/deactivation, filtering by active status, and improved validation. The API routes are extended to include endpoints for activating, deactivating, and listing all applications for admins. The ApiAuthMiddleware now checks the is_active status for API key authentication and returns appropriate error responses for inactive applications.
Bugfix/wn 322
joseganora
requested changes
Oct 6, 2025
Collaborator
joseganora
left a comment
There was a problem hiding this comment.
- Many comments in spanish
- Methods to reach database must be in the repository
- Keep dependence inyection
- Keep private $tenantId = 1; as a variable in the class
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 adds support for activating and deactivating API applications, enhances authentication logic to distinguish between API key and Basic Auth, and introduces relevant database and API changes. It also improves type casting and adds new admin endpoints for managing application status.
Authentication and middleware improvements:
ApiAuthMiddlewareto support both API key and Basic Auth authentication, with clear error messages for missing or invalid credentials, and checks for application active status before allowing access. (app/Http/Middleware/ApiAuthMiddleware.php[1] [2]Database and model updates:
is_activeboolean column to theapplicationstable via a migration, defaulting totrue. (database/migrations/2025_09_12_162459_add_is_active_to_aplications_table.phpdatabase/migrations/2025_09_12_162459_add_is_active_to_aplications_table.phpR1-R32)Applicationmodel to includeis_activein fillable fields, cast it as a boolean, and added anactivequery scope. Also enabled timestamps and fixed key generation to useStr::random. (app/Models/Application.php[1] [2] [3]API and routing changes:
routes/api.phproutes/api.phpR67-R71)Dependency management:
cipher-baseandsha.jsinpackage.jsonto ensure secure and up-to-date cryptography dependencies. (package.jsonpackage.jsonR21-R24)