mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Make query more clear
This commit is contained in:
parent
6c1484cd09
commit
fe3d3be7f5
1 changed files with 17 additions and 12 deletions
|
|
@ -77,22 +77,27 @@ export const subscriptionsResolver = authorized<
|
|||
user: { id: uid },
|
||||
})
|
||||
|
||||
if (type) {
|
||||
if (type && type == SubscriptionType.Newsletter) {
|
||||
queryBuilder.andWhere({
|
||||
type,
|
||||
status: SubscriptionStatus.Active,
|
||||
})
|
||||
}
|
||||
|
||||
queryBuilder.andWhere(
|
||||
new Brackets((qb) => {
|
||||
qb.where({
|
||||
type: SubscriptionType.Newsletter,
|
||||
status: SubscriptionStatus.Active,
|
||||
}).orWhere({
|
||||
type: SubscriptionType.Rss,
|
||||
} else if (type && type == SubscriptionType.Rss) {
|
||||
queryBuilder.where({
|
||||
type,
|
||||
})
|
||||
} else {
|
||||
queryBuilder.andWhere(
|
||||
new Brackets((qb) => {
|
||||
qb.where({
|
||||
type: SubscriptionType.Newsletter,
|
||||
status: SubscriptionStatus.Active,
|
||||
}).orWhere({
|
||||
type: SubscriptionType.Rss,
|
||||
})
|
||||
})
|
||||
})
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
const subscriptions = await queryBuilder
|
||||
.orderBy('subscription.' + sortBy, sortOrder)
|
||||
|
|
|
|||
Loading…
Reference in a new issue