mirror of
https://github.com/KevinMidboe/immich.git
synced 2025-10-29 17:40:28 +00:00
refactor(server): cron jobs (#2067)
This commit is contained in:
@@ -426,7 +426,7 @@ describe(UserService.name, () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('handleUserDeleteCheck', () => {
|
||||
describe('handleQueueUserDelete', () => {
|
||||
it('should skip users not ready for deletion', async () => {
|
||||
userRepositoryMock.getDeletedUsers.mockResolvedValue([
|
||||
{},
|
||||
@@ -435,7 +435,7 @@ describe(UserService.name, () => {
|
||||
{ deletedAt: makeDeletedAt(5) },
|
||||
] as UserEntity[]);
|
||||
|
||||
await sut.handleUserDeleteCheck();
|
||||
await sut.handleQueueUserDelete();
|
||||
|
||||
expect(userRepositoryMock.getDeletedUsers).toHaveBeenCalled();
|
||||
expect(jobMock.queue).not.toHaveBeenCalled();
|
||||
@@ -445,7 +445,7 @@ describe(UserService.name, () => {
|
||||
const user = { deletedAt: makeDeletedAt(10) };
|
||||
userRepositoryMock.getDeletedUsers.mockResolvedValue([user] as UserEntity[]);
|
||||
|
||||
await sut.handleUserDeleteCheck();
|
||||
await sut.handleQueueUserDelete();
|
||||
|
||||
expect(userRepositoryMock.getDeletedUsers).toHaveBeenCalled();
|
||||
expect(jobMock.queue).toHaveBeenCalledWith({ name: JobName.USER_DELETION, data: { user } });
|
||||
|
||||
@@ -141,7 +141,7 @@ export class UserService {
|
||||
return { admin, password, provided: !!providedPassword };
|
||||
}
|
||||
|
||||
async handleUserDeleteCheck() {
|
||||
async handleQueueUserDelete() {
|
||||
const users = await this.userRepository.getDeletedUsers();
|
||||
for (const user of users) {
|
||||
if (this.isReadyForDeletion(user)) {
|
||||
|
||||
Reference in New Issue
Block a user