refactor(server): user core (#4733)
This commit is contained in:
@@ -174,7 +174,7 @@ describe(AlbumService.name, () => {
|
||||
albumThumbnailAssetId: '123',
|
||||
});
|
||||
|
||||
expect(userMock.get).toHaveBeenCalledWith('user-id');
|
||||
expect(userMock.get).toHaveBeenCalledWith('user-id', {});
|
||||
});
|
||||
|
||||
it('should require valid userIds', async () => {
|
||||
@@ -185,7 +185,7 @@ describe(AlbumService.name, () => {
|
||||
sharedWithUserIds: ['user-3'],
|
||||
}),
|
||||
).rejects.toBeInstanceOf(BadRequestException);
|
||||
expect(userMock.get).toHaveBeenCalledWith('user-3');
|
||||
expect(userMock.get).toHaveBeenCalledWith('user-3', {});
|
||||
expect(albumMock.create).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -95,7 +95,7 @@ export class AlbumService {
|
||||
|
||||
async create(authUser: AuthUserDto, dto: CreateAlbumDto): Promise<AlbumResponseDto> {
|
||||
for (const userId of dto.sharedWithUserIds || []) {
|
||||
const exists = await this.userRepository.get(userId);
|
||||
const exists = await this.userRepository.get(userId, {});
|
||||
if (!exists) {
|
||||
throw new BadRequestException('User not found');
|
||||
}
|
||||
@@ -238,7 +238,7 @@ export class AlbumService {
|
||||
throw new BadRequestException('User already added');
|
||||
}
|
||||
|
||||
const user = await this.userRepository.get(userId);
|
||||
const user = await this.userRepository.get(userId, {});
|
||||
if (!user) {
|
||||
throw new BadRequestException('User not found');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user