Compare commits

..

No commits in common. "d03394bee727e2447b31865ce76867f6bac805f3" and "6454f5f8d64a26287dd8bb749e71875db54ae3df" have entirely different histories.

3 changed files with 13 additions and 12 deletions

View file

@ -191,11 +191,10 @@ class Albums extends Pages {
async patchOne() { async patchOne() {
const { itemId: _id } = this.req.params; const { itemId: _id } = this.req.params;
const { _id: User } = this.req.user; const { _id: User } = this.req.user;
const query = { const album = await AlbumsModel.findOne({
_id, _id,
User, User,
}; });
const album = await AlbumsModel.findOne(query);
if (!album) { if (!album) {
throw new ErrorEvent( throw new ErrorEvent(
@ -207,7 +206,9 @@ class Albums extends Pages {
const values = await getAlbumDetails(album.discogsId); const values = await getAlbumDetails(album.discogsId);
return AlbumsModel.findOneAndUpdate(query, values, { new: true }); await album.updateOne(values);
return album;
} }
/** /**

View file

@ -196,19 +196,19 @@
let url = `/api/v1/albums?userId=${this.userId}&page=${this.page}&limit=${this.limit}&sort=${this.sort}&order=${this.order}`; let url = `/api/v1/albums?userId=${this.userId}&page=${this.page}&limit=${this.limit}&sort=${this.sort}&order=${this.order}`;
if ( this.artist ) { if ( this.artist ) {
url += `&artists_sort=${this.artist.replace('&', '%26')}`; url += `&artists_sort=${this.artist}`;
} }
if ( this.format ) { if ( this.format ) {
url += `&format=${this.format.replace('&', '%26')}`; url += `&format=${this.format}`;
} }
if ( this.year ) { if ( this.year ) {
url += `&year=${this.year}`; url += `&year=${this.year}`;
} }
if ( this.genre ) { if ( this.genre ) {
url += `&genre=${this.genre.replace('&', '%26')}`; url += `&genre=${this.genre}`;
} }
if ( this.style ) { if ( this.style ) {
url += `&style=${this.style.replace('&', '%26')}`; url += `&style=${this.style}`;
} }
axios.get(url) axios.get(url)

View file

@ -250,19 +250,19 @@
let url = `/api/v1/albums?page=${this.page}&limit=${this.limit}&sort=${this.sort}&order=${this.order}`; let url = `/api/v1/albums?page=${this.page}&limit=${this.limit}&sort=${this.sort}&order=${this.order}`;
if ( this.artist ) { if ( this.artist ) {
url += `&artists_sort=${this.artist.replace('&', '%26')}`; url += `&artists_sort=${this.artist}`;
} }
if ( this.format ) { if ( this.format ) {
url += `&format=${this.format.replace('&', '%26')}`; url += `&format=${this.format}`;
} }
if ( this.year ) { if ( this.year ) {
url += `&year=${this.year}`; url += `&year=${this.year}`;
} }
if ( this.genre ) { if ( this.genre ) {
url += `&genre=${this.genre.replace('&', '%26')}`; url += `&genre=${this.genre}`;
} }
if ( this.style ) { if ( this.style ) {
url += `&style=${this.style.replace('&', '%26')}`; url += `&style=${this.style}`;
} }
axios.get(url) axios.get(url)