refactor(server): jobs and processors (#1787)

* refactor: jobs and processors

* refactor: storage migration processor

* fix: tests

* fix: code warning

* chore: ignore coverage from infra

* fix: sync move asset logic between job core and asset core

* refactor: move error handling inside of catch

* refactor(server): job core into dedicated service calls

* refactor: smart info

* fix: tests

* chore: smart info tests

* refactor: use asset repository

* refactor: thumbnail processor

* chore: coverage reqs
This commit is contained in:
Jason Rasmussen 2023-02-25 09:12:03 -05:00 committed by GitHub
parent 71d8567f18
commit 6c7679714b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
108 changed files with 1645 additions and 1072 deletions

View file

@ -2,7 +2,7 @@ import { UserEntity } from '../entities';
import { IUserRepository, UserListFilter } from '@app/domain';
import { Injectable, InternalServerErrorException } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Not, Repository } from 'typeorm';
import { IsNull, Not, Repository } from 'typeorm';
@Injectable()
export class UserRepository implements IUserRepository {
@ -33,6 +33,10 @@ export class UserRepository implements IUserRepository {
return this.userRepository.findOne({ where: { oauthId } });
}
async getDeletedUsers(): Promise<UserEntity[]> {
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
@ -61,8 +65,12 @@ export class UserRepository implements IUserRepository {
return updatedUser;
}
async delete(user: UserEntity): Promise<UserEntity> {
return this.userRepository.softRemove(user);
async delete(user: UserEntity, hard?: boolean): Promise<UserEntity> {
if (hard) {
return this.userRepository.remove(user);
} else {
return this.userRepository.softRemove(user);
}
}
async restore(user: UserEntity): Promise<UserEntity> {