Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
abdelillah committed Jul 4, 2022
1 parent ff4acb1 commit bcf5e75
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/tracks/tracks.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export class TracksService {
async findTracksByUserId(id: string): Promise<TrackDocument[]> {
this.logger.log(`Finding track by id ${id}`);
isValidId(id);
return await this.trackModel.find({ author: id }).select('_id').catch(() => {
return await this.trackModel.find({ author: id }).catch(() => {
throw new BadRequestException(
`Tracks for user with ID "${id}" doesn't exist`,
);
Expand Down
6 changes: 4 additions & 2 deletions src/views/views.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@ export class ViewsService {

async findViewsByUserId(userId: string) {
this.logger.log(`Finding views of user ${userId}`);
const objectIds = await this.tracksService.findTracksByUserId(userId);
const ids = objectIds.map((track) => track._id.toString());
const ids = await this.tracksService
.findTracksByUserId(userId)
.then((tracks) => tracks.map((track) => track._id));
console.log(ids);
return await this.viewModel.aggregate([
{
$match: {
Expand Down

0 comments on commit bcf5e75

Please sign in to comment.