mirror of
https://github.com/KevinMidboe/immich.git
synced 2025-10-29 17:40:28 +00:00
feat(web,server): user storage label (#2418)
* feat: user storage label * chore: open api * fix: checks * fix: api update validation and tests * feat: default admin storage label * fix: linting * fix: user create/update dto * fix: delete library with custom label
This commit is contained in:
@@ -6,10 +6,7 @@ import { UserEntity } from '../entities';
|
||||
|
||||
@Injectable()
|
||||
export class UserRepository implements IUserRepository {
|
||||
constructor(
|
||||
@InjectRepository(UserEntity)
|
||||
private userRepository: Repository<UserEntity>,
|
||||
) {}
|
||||
constructor(@InjectRepository(UserEntity) private userRepository: Repository<UserEntity>) {}
|
||||
|
||||
async get(userId: string, withDeleted?: boolean): Promise<UserEntity | null> {
|
||||
return this.userRepository.findOne({ where: { id: userId }, withDeleted: withDeleted });
|
||||
@@ -29,6 +26,10 @@ export class UserRepository implements IUserRepository {
|
||||
return builder.getOne();
|
||||
}
|
||||
|
||||
async getByStorageLabel(storageLabel: string): Promise<UserEntity | null> {
|
||||
return this.userRepository.findOne({ where: { storageLabel } });
|
||||
}
|
||||
|
||||
async getByOAuthId(oauthId: string): Promise<UserEntity | null> {
|
||||
return this.userRepository.findOne({ where: { oauthId } });
|
||||
}
|
||||
@@ -37,13 +38,9 @@ export class UserRepository implements IUserRepository {
|
||||
return this.userRepository.find({ withDeleted: true, where: { deletedAt: Not(IsNull()) } });
|
||||
}
|
||||
|
||||
async getList({ excludeId }: UserListFilter = {}): Promise<UserEntity[]> {
|
||||
if (!excludeId) {
|
||||
return this.userRepository.find(); // TODO: this should also be ordered the same as below
|
||||
}
|
||||
async getList({ withDeleted }: UserListFilter = {}): Promise<UserEntity[]> {
|
||||
return this.userRepository.find({
|
||||
where: { id: Not(excludeId) },
|
||||
withDeleted: true,
|
||||
withDeleted,
|
||||
order: {
|
||||
createdAt: 'DESC',
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user