Compare commits
No commits in common. "7b525d3e432e5be2582deee0a0d79d5b433a1129" and "e01dbd5c3121f944c33af8cccd763f5d61c386b3" have entirely different histories.
7b525d3e43
...
e01dbd5c31
5 changed files with 2 additions and 43 deletions
|
@ -113,7 +113,6 @@ Vue.createApp({
|
|||
format,
|
||||
genre,
|
||||
style,
|
||||
inCollection,
|
||||
} = results[i];
|
||||
items.push({
|
||||
id,
|
||||
|
@ -124,7 +123,6 @@ Vue.createApp({
|
|||
format,
|
||||
genre,
|
||||
style,
|
||||
inCollection,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -7,18 +7,10 @@
|
|||
.list {
|
||||
margin-top: 2rem;
|
||||
|
||||
.item {
|
||||
.item{
|
||||
img {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
&.in-collection {
|
||||
opacity: 0.6;
|
||||
|
||||
small {
|
||||
font-style: italic;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -167,7 +167,6 @@ Publié automatiquement via #musictopus`;
|
|||
genre,
|
||||
style,
|
||||
userId: collectionUserId,
|
||||
discogsIds,
|
||||
} = this.req.query;
|
||||
|
||||
let userId = this.req.user?._id;
|
||||
|
@ -217,10 +216,6 @@ Publié automatiquement via #musictopus`;
|
|||
userId = userIsSharingCollection._id;
|
||||
}
|
||||
|
||||
if (discogsIds) {
|
||||
where.discogsId = { $in: discogsIds };
|
||||
}
|
||||
|
||||
const count = await AlbumsModel.count({
|
||||
User: userId,
|
||||
...where,
|
||||
|
|
|
@ -3,7 +3,6 @@ import { ensureLoggedIn } from "connect-ensure-login";
|
|||
|
||||
import { sendResponse } from "../../../libs/format";
|
||||
import { searchSong, getAlbumDetails } from "../../../helpers";
|
||||
import Albums from "../../../middleware/Albums";
|
||||
|
||||
// eslint-disable-next-line new-cap
|
||||
const router = express.Router();
|
||||
|
@ -17,30 +16,6 @@ router.route("/").get(ensureLoggedIn("/connexion"), async (req, res, next) => {
|
|||
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);
|
||||
} catch (err) {
|
||||
next(err);
|
||||
|
|
|
@ -34,9 +34,8 @@
|
|||
|
||||
|
||||
<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>
|
||||
<small v-if="item.inCollection"> (Dans ma collection)</small>
|
||||
<div class="grid grid-cols-2 md:grid-cols-4">
|
||||
<div>
|
||||
<img :src="item.thumb" :alt="item.title" @click="loadDetails(item.id)"/>
|
||||
|
|
Loading…
Reference in a new issue