move sorting to backend

This commit is contained in:
mgabor
2024-04-21 18:05:35 +02:00
parent 29dd9ff4d8
commit 6b075c21b6
2 changed files with 11 additions and 9 deletions

View File

@@ -136,6 +136,16 @@ export const mapAlbum = (entity: AlbumEntity, withAssets: boolean, auth?: AuthDt
}
}
albumUsers.sort((a, b) => {
if (a.role === AlbumUserRole.VIEWER && b.role === AlbumUserRole.EDITOR) {
return 1;
}
if (a.role === AlbumUserRole.EDITOR && b.role === AlbumUserRole.VIEWER) {
return -1;
}
return a.user.name.localeCompare(b.user.name);
});
const assets = entity.assets || [];
const hasSharedLink = entity.sharedLinks?.length > 0;