mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-04-04 06:47:19 +02:00
fix: add rollback on rename failure and update PR description
- Roll back user migration if updateRoleByName returns null during a rename (race: role deleted between existence check and update) - Add test verifying rollback calls updateUsersByRole in reverse - Update PR #12400 description to reflect current test counts (56 handler tests, 40 data-layer tests) and safety features
This commit is contained in:
parent
94fdb3cd93
commit
16bb113614
2 changed files with 23 additions and 0 deletions
|
|
@ -163,6 +163,9 @@ export function createAdminRolesHandlers(deps: AdminRolesDeps) {
|
|||
|
||||
const role = await updateRoleByName(name, updates);
|
||||
if (!role) {
|
||||
if (isRename) {
|
||||
await updateUsersByRole(trimmedName, name);
|
||||
}
|
||||
return res.status(404).json({ error: 'Role not found' });
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue