mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
feat(server): user preferences (#9736)
* refactor(server): user endpoints * feat(server): user preferences * mobile: user preference * wording --------- Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
parent
1f9158c545
commit
0fc6d69824
39 changed files with 1392 additions and 327 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import _ from 'lodash';
|
||||
import { UserPreferencesUpdateDto } from 'src/dtos/user-preferences.dto';
|
||||
import { UserMetadataKey, UserPreferences, getDefaultPreferences } from 'src/entities/user-metadata.entity';
|
||||
import { UserEntity } from 'src/entities/user.entity';
|
||||
import { getKeysDeep } from 'src/utils/misc';
|
||||
|
|
@ -37,3 +38,12 @@ export const getPreferencesPartial = (user: { email: string }, newPreferences: U
|
|||
|
||||
return partial;
|
||||
};
|
||||
|
||||
export const mergePreferences = (user: UserEntity, dto: UserPreferencesUpdateDto) => {
|
||||
const preferences = getPreferences(user);
|
||||
for (const key of getKeysDeep(dto)) {
|
||||
_.set(preferences, key, _.get(dto, key));
|
||||
}
|
||||
|
||||
return preferences;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue