mirror of
https://github.com/mjrode/WhatToWatch.git
synced 2026-01-06 05:29:34 -06:00
21 lines
472 B
JavaScript
21 lines
472 B
JavaScript
import models from '../../db/models';
|
|
import helpers from '../helpers';
|
|
import {Op} from 'sequelize';
|
|
|
|
const getMostWatched = async (req, res) => {
|
|
try {
|
|
console.log('mike');
|
|
const mostWatched = await models.PlexLibrary.findAll({
|
|
where: {UserId: req.user.id, views: {[Op.gt]: 0}},
|
|
});
|
|
console.log('mostwatched', mostWatched);
|
|
res.json(mostWatched);
|
|
} catch (error) {
|
|
res.json(error.message);
|
|
}
|
|
};
|
|
|
|
export default {
|
|
getMostWatched,
|
|
};
|