mirror of
https://github.com/immich-app/immich.git
synced 2025-12-25 17:24:58 +03:00
fix(server): restore user (#15763)
This commit is contained in:
@@ -173,9 +173,9 @@ describe(UserAdminService.name, () => {
|
||||
|
||||
it('should restore an user', async () => {
|
||||
userMock.get.mockResolvedValue(userStub.user1);
|
||||
userMock.update.mockResolvedValue(userStub.user1);
|
||||
userMock.restore.mockResolvedValue(userStub.user1);
|
||||
await expect(sut.restore(authStub.admin, userStub.user1.id)).resolves.toEqual(mapUserAdmin(userStub.user1));
|
||||
expect(userMock.update).toHaveBeenCalledWith(userStub.user1.id, { status: UserStatus.ACTIVE, deletedAt: null });
|
||||
expect(userMock.restore).toHaveBeenCalledWith(userStub.user1.id);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -102,7 +102,7 @@ export class UserAdminService extends BaseService {
|
||||
async restore(auth: AuthDto, id: string): Promise<UserAdminResponseDto> {
|
||||
await this.findOrFail(id, { withDeleted: true });
|
||||
await this.albumRepository.restoreAll(id);
|
||||
const user = await this.userRepository.update(id, { deletedAt: null, status: UserStatus.ACTIVE });
|
||||
const user = await this.userRepository.restore(id);
|
||||
return mapUserAdmin(user);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user