fix(models-utils): add pending_role_ids to Notification model#15
Merged
fix(models-utils): add pending_role_ids to Notification model#15
Conversation
…) utilities - serialize_for_audit(): converts UUID/datetime/date/Decimal to str for audit logging Replaces 9 duplicated dict comprehensions in backend-erp routers; also handles datetime/date/Decimal which the inline comprehensions missed - compute_pagination(): centralizes repeated skip/total_pages arithmetic Replaces duplicated blocks in clients.py, orders.py, products.py Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add optional JSON field to store role IDs from signup requests. Enables the auth-erp approval flow to assign the correct roles when a signup notification is approved by an admin. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
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.
Summary
pending_role_ids(nullable JSON column) to theNotificationmodel to persist role IDs submitted during user signup0f529c470393that appliesADD COLUMN notification.pending_role_ids JSON NULLsignup_userbut immediately discarded, so the approval handler had no way to assign themMotivation
When a user signs up for an existing company via
POST /signup/user, they can optionally request specific roles. The endpoint validated those role IDs correctly but then excluded them from theNotificationrecord. The approval handler innotifications.pytherefore always fell back to assigning only the defaultUSERrole, silently ignoring the requested roles.Test plan
alembic upgrade headand confirm migration applies cleanlynotificationtable has newpending_role_idscolumn (nullable JSON)alembic downgrade -1correctly drops the columnpending_role_ids = NULL) are unaffectedCo-Authored-By: Claude Sonnet 4.5 noreply@anthropic.com
Generated with Claude Code