Avancement de la connexion avec le back pour la partie user
This commit is contained in:
commit
bde03fb908
2 changed files with 6 additions and 5 deletions
|
|
@ -70,7 +70,7 @@ exports.findAll = (req, res) => {
|
||||||
query.url = condition;
|
query.url = condition;
|
||||||
|
|
||||||
const interests = req.query.interests;
|
const interests = req.query.interests;
|
||||||
condition = interests ? {$in: interests} : undefined;
|
condition = interests ? {$in: interests.split(',')} : undefined;
|
||||||
query["interests.interest"] = condition
|
query["interests.interest"] = condition
|
||||||
|
|
||||||
const comment = req.query.comment;
|
const comment = req.query.comment;
|
||||||
|
|
@ -174,9 +174,9 @@ exports.update = (req, res) => {
|
||||||
condition = url ? url : undefined;
|
condition = url ? url : undefined;
|
||||||
update.url = condition;
|
update.url = condition;
|
||||||
|
|
||||||
const interests = req.body.interests;
|
let interests = req.body.interests;
|
||||||
condition = interests ? interests : undefined;
|
condition = interests ? {interests: [...new Map(interests.map(v => [v.id, v])).values()]} : undefined;
|
||||||
update.interests = condition;
|
update.$addToSet = condition;
|
||||||
|
|
||||||
const comment = req.body.comment;
|
const comment = req.body.comment;
|
||||||
condition = comment ? comment : undefined;
|
condition = comment ? comment : undefined;
|
||||||
|
|
|
||||||
|
|
@ -457,7 +457,8 @@ exports.history = (req, res) => {
|
||||||
watchedDate: {$arrayElemAt: ["$watchedDates", -1]},
|
watchedDate: {$arrayElemAt: ["$watchedDates", -1]},
|
||||||
createdAt: true,
|
createdAt: true,
|
||||||
updatedAt: true
|
updatedAt: true
|
||||||
}}])
|
}},
|
||||||
|
{$sort: {watchedDate: -1}}])
|
||||||
.then(async data => {
|
.then(async data => {
|
||||||
let yt_results = [];
|
let yt_results = [];
|
||||||
let dm_results = [];
|
let dm_results = [];
|
||||||
|
|
|
||||||
Reference in a new issue