fix(server): album statistics endpoint (#11924)

This commit is contained in:
Jason Rasmussen
2024-08-20 07:50:36 -04:00
committed by GitHub
parent cde0458dc8
commit ef9a06be5c
14 changed files with 111 additions and 111 deletions

View File

@@ -43,12 +43,12 @@ describe(AlbumService.name, () => {
expect(sut).toBeDefined();
});
describe('getCount', () => {
describe('getStatistics', () => {
it('should get the album count', async () => {
albumMock.getOwned.mockResolvedValue([]);
albumMock.getShared.mockResolvedValue([]);
albumMock.getNotShared.mockResolvedValue([]);
await expect(sut.getCount(authStub.admin)).resolves.toEqual({
await expect(sut.getStatistics(authStub.admin)).resolves.toEqual({
owned: 0,
shared: 0,
notShared: 0,

View File

@@ -1,9 +1,9 @@
import { BadRequestException, Inject, Injectable } from '@nestjs/common';
import {
AddUsersDto,
AlbumCountResponseDto,
AlbumInfoDto,
AlbumResponseDto,
AlbumStatisticsResponseDto,
CreateAlbumDto,
GetAlbumsDto,
UpdateAlbumDto,
@@ -37,7 +37,7 @@ export class AlbumService {
@Inject(IAlbumUserRepository) private albumUserRepository: IAlbumUserRepository,
) {}
async getCount(auth: AuthDto): Promise<AlbumCountResponseDto> {
async getStatistics(auth: AuthDto): Promise<AlbumStatisticsResponseDto> {
const [owned, shared, notShared] = await Promise.all([
this.albumRepository.getOwned(auth.user.id),
this.albumRepository.getShared(auth.user.id),