Commit 9db8c85c authored by Цой Данил's avatar Цой Данил 💬

#4 added extra task to track part task

parent c24e5de2
...@@ -3,6 +3,7 @@ import { EStatuses } from "../enum/EStatuses"; ...@@ -3,6 +3,7 @@ import { EStatuses } from "../enum/EStatuses";
import IResponse from "../interfaces/IResponse"; import IResponse from "../interfaces/IResponse";
import ITrack from "../interfaces/ITrack"; import ITrack from "../interfaces/ITrack";
import ITrackDto from "../interfaces/ITrackDto"; import ITrackDto from "../interfaces/ITrackDto";
import { Album } from "../models/Album";
import { Track } from "../models/Track"; import { Track } from "../models/Track";
...@@ -13,6 +14,8 @@ export class TracksService { ...@@ -13,6 +14,8 @@ export class TracksService {
let data let data
if (req.query.album){ if (req.query.album){
data = await Track.find({album: req.query.album}).populate('album') data = await Track.find({album: req.query.album}).populate('album')
} else if (req.query.artist){
data = await Track.find({album: await Album.find({artist: req.query.artist})}).populate('album')
} else{ } else{
data = await Track.find().populate('album') data = await Track.find().populate('album')
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment