mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
parent
eb8dfa283e
commit
3066c8198c
20 changed files with 640 additions and 160 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import { BadRequestException, ForbiddenException, Injectable } from '@nestjs/common';
|
||||
import { SALT_ROUNDS } from 'src/constants';
|
||||
import { AssetStatsDto, AssetStatsResponseDto, mapStats } from 'src/dtos/asset.dto';
|
||||
import { AuthDto } from 'src/dtos/auth.dto';
|
||||
import { UserPreferencesResponseDto, UserPreferencesUpdateDto, mapPreferences } from 'src/dtos/user-preferences.dto';
|
||||
import {
|
||||
|
|
@ -18,7 +19,10 @@ import { getPreferences, getPreferencesPartial, mergePreferences } from 'src/uti
|
|||
@Injectable()
|
||||
export class UserAdminService extends BaseService {
|
||||
async search(auth: AuthDto, dto: UserAdminSearchDto): Promise<UserAdminResponseDto[]> {
|
||||
const users = await this.userRepository.getList({ withDeleted: dto.withDeleted });
|
||||
const users = await this.userRepository.getList({
|
||||
id: dto.id,
|
||||
withDeleted: dto.withDeleted,
|
||||
});
|
||||
return users.map((user) => mapUserAdmin(user));
|
||||
}
|
||||
|
||||
|
|
@ -109,6 +113,11 @@ export class UserAdminService extends BaseService {
|
|||
return mapUserAdmin(user);
|
||||
}
|
||||
|
||||
async getStatistics(auth: AuthDto, id: string, dto: AssetStatsDto): Promise<AssetStatsResponseDto> {
|
||||
const stats = await this.assetRepository.getStatistics(auth.user.id, dto);
|
||||
return mapStats(stats);
|
||||
}
|
||||
|
||||
async getPreferences(auth: AuthDto, id: string): Promise<UserPreferencesResponseDto> {
|
||||
await this.findOrFail(id, { withDeleted: true });
|
||||
const metadata = await this.userRepository.getMetadata(id);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue