add setting to limit feeds per user

This commit is contained in:
Athou
2023-05-30 08:53:26 +02:00
parent 09d21d88a4
commit 3e6451289f
7 changed files with 29 additions and 8 deletions

View File

@@ -59,6 +59,10 @@ public class FeedSubscriptionDAO extends GenericDAO<FeedSubscription> {
return initRelations(subs);
}
public Long count(User user) {
return query().select(sub.count()).from(sub).where(sub.user.eq(user)).fetchOne();
}
public List<FeedSubscription> findByCategory(User user, FeedCategory category) {
JPQLQuery<FeedSubscription> query = query().selectFrom(sub).where(sub.user.eq(user));
if (category == null) {