mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
feat(server): user metadata (#9650)
* feat(server): user metadata * add missing method to user mock * update migration to include cascades * update sql files * test: fix e2e * chore: clean up --------- Co-authored-by: Daniel Dietzler <mail@ddietzler.dev>
This commit is contained in:
parent
a4887bfa7e
commit
06ce8247cc
24 changed files with 267 additions and 126 deletions
|
|
@ -1,8 +1,9 @@
|
|||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { Transform } from 'class-transformer';
|
||||
import { IsBoolean, IsEmail, IsEnum, IsNotEmpty, IsNumber, IsPositive, IsString, IsUUID } from 'class-validator';
|
||||
import { getRandomAvatarColor } from 'src/dtos/user-profile.dto';
|
||||
import { UserAvatarColor, UserEntity, UserStatus } from 'src/entities/user.entity';
|
||||
import { UserAvatarColor } from 'src/entities/user-metadata.entity';
|
||||
import { UserEntity, UserStatus } from 'src/entities/user.entity';
|
||||
import { getPreferences } from 'src/utils/preferences';
|
||||
import { Optional, ValidateBoolean, toEmail, toSanitized } from 'src/validation';
|
||||
|
||||
export class CreateUserDto {
|
||||
|
|
@ -151,7 +152,7 @@ export const mapSimpleUser = (entity: UserEntity): UserDto => {
|
|||
email: entity.email,
|
||||
name: entity.name,
|
||||
profileImagePath: entity.profileImagePath,
|
||||
avatarColor: entity.avatarColor ?? getRandomAvatarColor(entity),
|
||||
avatarColor: getPreferences(entity).avatar.color,
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -165,7 +166,7 @@ export function mapUser(entity: UserEntity): UserResponseDto {
|
|||
deletedAt: entity.deletedAt,
|
||||
updatedAt: entity.updatedAt,
|
||||
oauthId: entity.oauthId,
|
||||
memoriesEnabled: entity.memoriesEnabled,
|
||||
memoriesEnabled: getPreferences(entity).memories.enabled,
|
||||
quotaSizeInBytes: entity.quotaSizeInBytes,
|
||||
quotaUsageInBytes: entity.quotaUsageInBytes,
|
||||
status: entity.status,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue