Skip to content

fix(models-utils): add pending_role_ids to Notification model#15

Merged
pel19072 merged 2 commits intomainfrom
fix/notification-pending-roles
Feb 17, 2026
Merged

fix(models-utils): add pending_role_ids to Notification model#15
pel19072 merged 2 commits intomainfrom
fix/notification-pending-roles

Conversation

@pel19072
Copy link
Copy Markdown
Owner

Summary

  • Adds pending_role_ids (nullable JSON column) to the Notification model to persist role IDs submitted during user signup
  • Adds Alembic migration 0f529c470393 that applies ADD COLUMN notification.pending_role_ids JSON NULL
  • This field is the missing link in the signup-approval flow: previously, role IDs were validated in signup_user but immediately discarded, so the approval handler had no way to assign them

Motivation

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 the Notification record. The approval handler in notifications.py therefore always fell back to assigning only the default USER role, silently ignoring the requested roles.

Test plan

  • Run alembic upgrade head and confirm migration applies cleanly
  • Confirm notification table has new pending_role_ids column (nullable JSON)
  • Confirm alembic downgrade -1 correctly drops the column
  • Test that existing notifications (with pending_role_ids = NULL) are unaffected

Co-Authored-By: Claude Sonnet 4.5 noreply@anthropic.com

Generated with Claude Code

pel19072 and others added 2 commits February 16, 2026 22:12
…) 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>
@pel19072 pel19072 merged commit 0a587a6 into main Feb 17, 2026
1 check failed
@pel19072 pel19072 deleted the fix/notification-pending-roles branch February 17, 2026 15:59
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.

1 participant