Compare commits

..

No commits in common. "7b525d3e432e5be2582deee0a0d79d5b433a1129" and "e01dbd5c3121f944c33af8cccd763f5d61c386b3" have entirely different histories.

5 changed files with 2 additions and 43 deletions

View file

@ -113,7 +113,6 @@ Vue.createApp({
format, format,
genre, genre,
style, style,
inCollection,
} = results[i]; } = results[i];
items.push({ items.push({
id, id,
@ -124,7 +123,6 @@ Vue.createApp({
format, format,
genre, genre,
style, style,
inCollection,
}); });
} }

View file

@ -11,14 +11,6 @@
img { img {
cursor: pointer; cursor: pointer;
} }
&.in-collection {
opacity: 0.6;
small {
font-style: italic;
}
}
} }
} }
} }

View file

@ -167,7 +167,6 @@ Publié automatiquement via #musictopus`;
genre, genre,
style, style,
userId: collectionUserId, userId: collectionUserId,
discogsIds,
} = this.req.query; } = this.req.query;
let userId = this.req.user?._id; let userId = this.req.user?._id;
@ -217,10 +216,6 @@ Publié automatiquement via #musictopus`;
userId = userIsSharingCollection._id; userId = userIsSharingCollection._id;
} }
if (discogsIds) {
where.discogsId = { $in: discogsIds };
}
const count = await AlbumsModel.count({ const count = await AlbumsModel.count({
User: userId, User: userId,
...where, ...where,

View file

@ -3,7 +3,6 @@ import { ensureLoggedIn } from "connect-ensure-login";
import { sendResponse } from "../../../libs/format"; import { sendResponse } from "../../../libs/format";
import { searchSong, getAlbumDetails } from "../../../helpers"; import { searchSong, getAlbumDetails } from "../../../helpers";
import Albums from "../../../middleware/Albums";
// eslint-disable-next-line new-cap // eslint-disable-next-line new-cap
const router = express.Router(); const router = express.Router();
@ -17,30 +16,6 @@ router.route("/").get(ensureLoggedIn("/connexion"), async (req, res, next) => {
req.query.country || null req.query.country || null
); );
const discogsIds = [];
const foundIds = [];
for (let i = 0; i < data.results.length; i += 1) {
discogsIds.push(data.results[i].id);
}
req.query.discogsIds = discogsIds;
const albums = new Albums(req);
const myAlbums = await albums.getAll();
if (myAlbums.rows) {
for (let i = 0; i < myAlbums.rows.length; i += 1) {
foundIds.push(myAlbums.rows[i].discogsId);
}
}
for (let i = 0; i < data.results.length; i += 1) {
data.results[i].inCollection = foundIds.includes(
data.results[i].id
);
}
sendResponse(req, res, data); sendResponse(req, res, data);
} catch (err) { } catch (err) {
next(err); next(err);

View file

@ -34,9 +34,8 @@
<div class="grid grid-cols-1 md:grid-cols-2 list hover"> <div class="grid grid-cols-1 md:grid-cols-2 list hover">
<div v-if="!loading" v-for="item in items" class="item" :class="{'in-collection': item.inCollection}"> <div class="item" v-if="!loading" v-for="item in items">
<a @click="loadDetails(item.id)" class="title">{{ item.artists_sort }} {{ item.title }}</a> <a @click="loadDetails(item.id)" class="title">{{ item.artists_sort }} {{ item.title }}</a>
<small v-if="item.inCollection"> (Dans ma collection)</small>
<div class="grid grid-cols-2 md:grid-cols-4"> <div class="grid grid-cols-2 md:grid-cols-4">
<div> <div>
<img :src="item.thumb" :alt="item.title" @click="loadDetails(item.id)"/> <img :src="item.thumb" :alt="item.title" @click="loadDetails(item.id)"/>