refactor: use factory and kysely types for partner repository (#16812)

This commit is contained in:
Jason Rasmussen
2025-03-11 16:29:56 -04:00
committed by GitHub
parent 83ed03920e
commit 16fd19994b
11 changed files with 207 additions and 112 deletions
+12
View File
@@ -1,6 +1,7 @@
import { ApiProperty } from '@nestjs/swagger';
import { Transform } from 'class-transformer';
import { IsBoolean, IsEmail, IsNotEmpty, IsNumber, IsPositive, IsString } from 'class-validator';
import { User } from 'src/database';
import { UserMetadataEntity } from 'src/entities/user-metadata.entity';
import { UserEntity } from 'src/entities/user.entity';
import { UserAvatarColor, UserMetadataKey, UserStatus } from 'src/enum';
@@ -52,6 +53,17 @@ export const mapUser = (entity: UserEntity): UserResponseDto => {
};
};
export const mapDatabaseUser = (user: User): UserResponseDto => {
return {
id: user.id,
email: user.email,
name: user.name,
profileImagePath: user.profileImagePath,
avatarColor: getPreferences(user.email, []).avatar.color,
profileChangedAt: user.profileChangedAt,
};
};
export class UserAdminSearchDto {
@ValidateBoolean({ optional: true })
withDeleted?: boolean;