Skip to content

Fix: External identifier validation error handling#5553

Open
KroZen-Dev wants to merge 5 commits intopterodactyl:1.0-developfrom
KroZen-Dev:fix/external-identifier
Open

Fix: External identifier validation error handling#5553
KroZen-Dev wants to merge 5 commits intopterodactyl:1.0-developfrom
KroZen-Dev:fix/external-identifier

Conversation

@KroZen-Dev
Copy link

This pull request introduces stricter validation to ensure that the external_id field for servers remains unique when updating server details, and adds a utility method for update validation rules. The changes enhance data integrity and provide clearer error handling for duplicate external IDs.

Validation Improvements:

  • Added a uniqueness check for external_id in the ServersController update logic, throwing a ValidationException if a duplicate is found when updating a server.
  • Added a similar uniqueness validation for external_id in ServerFormRequest, ensuring that form requests also enforce this rule and provide user-friendly error messages.

Model Enhancements:

  • Introduced a new static method getRulesForUpdate in the Server model to generate validation rules suitable for update operations, handling uniqueness checks and allowing for the exclusion of the current record.
  • Imported the Rule class in Server.php to support advanced validation rule definitions.

🔗 Linked Issue:

#5549

Added validation for unique external_id when updating server details.
Add validation rules for updating server models.
@AndyIsHereBoi
Copy link
Contributor

@KroZen-Dev instead of saying The external identifier must be unique to this server. shouldn't it say it has to be unique on the panel? its not possible to assign more than 1 to a individual server

@KroZen-Dev
Copy link
Author

@KroZen-Dev instead of saying The external identifier must be unique to this server. shouldn't it say it has to be unique on the panel? its not possible to assign more than 1 to a individual server

Agreed, corrected

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.

2 participants