#60 - Bug au refresh d'un album
This commit is contained in:
parent
4da4dd9423
commit
d03394bee7
1 changed files with 4 additions and 5 deletions
|
@ -191,10 +191,11 @@ class Albums extends Pages {
|
|||
async patchOne() {
|
||||
const { itemId: _id } = this.req.params;
|
||||
const { _id: User } = this.req.user;
|
||||
const album = await AlbumsModel.findOne({
|
||||
const query = {
|
||||
_id,
|
||||
User,
|
||||
});
|
||||
};
|
||||
const album = await AlbumsModel.findOne(query);
|
||||
|
||||
if (!album) {
|
||||
throw new ErrorEvent(
|
||||
|
@ -206,9 +207,7 @@ class Albums extends Pages {
|
|||
|
||||
const values = await getAlbumDetails(album.discogsId);
|
||||
|
||||
await album.updateOne(values);
|
||||
|
||||
return album;
|
||||
return AlbumsModel.findOneAndUpdate(query, values, { new: true });
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue