Modify invitation Args: invitation_id (int): Invitation ID updates (Dict[str, Any]): Fields to update updated_by (Optional[str]): Updated by user Returns: bool: Whether update was successful
(invitation_id: int, updates: Dict[str, Any], updated_by: Optional[str] = None)
| 106 | |
| 107 | |
| 108 | def modify_invitation(invitation_id: int, updates: Dict[str, Any], updated_by: Optional[str] = None) -> bool: |
| 109 | """ |
| 110 | Modify invitation |
| 111 | |
| 112 | Args: |
| 113 | invitation_id (int): Invitation ID |
| 114 | updates (Dict[str, Any]): Fields to update |
| 115 | updated_by (Optional[str]): Updated by user |
| 116 | |
| 117 | Returns: |
| 118 | bool: Whether update was successful |
| 119 | """ |
| 120 | with get_db_session() as session: |
| 121 | update_data = updates.copy() |
| 122 | if updated_by: |
| 123 | update_data["updated_by"] = updated_by |
| 124 | |
| 125 | # Convert group_ids list to string if present |
| 126 | if "group_ids" in update_data and isinstance(update_data["group_ids"], list): |
| 127 | update_data["group_ids"] = convert_list_to_string(update_data["group_ids"]) |
| 128 | |
| 129 | result = session.query(TenantInvitationCode).filter( |
| 130 | TenantInvitationCode.invitation_id == invitation_id, |
| 131 | TenantInvitationCode.delete_flag == "N" |
| 132 | ).update(update_data, synchronize_session=False) |
| 133 | |
| 134 | return result > 0 |
| 135 | |
| 136 | |
| 137 | def remove_invitation(invitation_id: int, updated_by: Optional[str] = None) -> bool: |