Skip to content

Commit

Permalink
update recently added
Browse files Browse the repository at this point in the history
  • Loading branch information
atlanticdesign committed May 5, 2020
1 parent e87f09d commit 143de1f
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions graphql/queries/recently-added.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,11 @@ const RecentlyAdded = {
async resolve(root: any, args: any, ctx: any) {
await getAuthenticatedUser(ctx);

let entries = await Database.models.entry
.findAll({
limit: 25,
order: [['publishedAt', 'DESC']],
include: [{ model: Database.models.user, as: 'EntryOwner' }],
})
.filter((entry: any) => {
if (
entry.EntryOwner &&
entry.EntryOwner[0] &&
entry.EntryOwner[0].dataValues
) {
let entryOwner = entry.EntryOwner[0].dataValues;
return !entryOwner.testing;
}
return false;
});
let entries = await Database.models.entry.findAll({
limit: 25,
order: [['publishedAt', 'DESC']],
include: [{ model: Database.models.user, as: 'EntryOwner' }],
});
return entries;
},
};
Expand Down

0 comments on commit 143de1f

Please sign in to comment.