feat(server, web): smart merge (#5796)

* pr feedback

* fix: tests

* update assets statistics

* pr feedback

* pr feedback

* fix: linter

* pr feedback

* fix: don't limit the smart merge

* pr feedback

* fix: server code

---------

Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
This commit is contained in:
martin 2024-01-18 02:52:11 +01:00 committed by GitHub
parent c55503496f
commit f0b328fb6b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 168 additions and 91 deletions

View file

@ -26,7 +26,7 @@
let dispatch = createEventDispatcher<{
back: void;
merge: void;
merge: PersonResponseDto;
}>();
$: hasSelection = selectedPeople.length > 0;
@ -68,16 +68,17 @@
const handleMerge = async () => {
try {
const { data: results } = await api.personApi.mergePerson({
let { data: results } = await api.personApi.mergePerson({
id: person.id,
mergePersonDto: { ids: selectedPeople.map(({ id }) => id) },
});
const { data: mergedPerson } = await api.personApi.getPerson({ id: person.id });
const count = results.filter(({ success }) => success).length;
notificationController.show({
message: `Merged ${count} ${count === 1 ? 'person' : 'people'}`,
type: NotificationType.Info,
});
dispatch('merge');
dispatch('merge', mergedPerson);
} catch (error) {
handleError(error, 'Cannot merge people');
} finally {