Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions api/resolvers/item.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ export const whereClause = (...clauses) => {
}

function whenClause (when, table) {
return `"${table}".created_at <= $2 and "${table}".created_at >= $1`
return `COALESCE("${table}"."invoicePaidAt", "${table}".created_at) <= $2 and COALESCE("${table}"."invoicePaidAt", "${table}".created_at) >= $1`
}

export const activeOrMine = (me) => {
Expand Down Expand Up @@ -433,7 +433,7 @@ export default {
${SELECT}
${relationClause(type)}
${whereClause(
'"Item".created_at <= $1',
'COALESCE("Item"."invoicePaidAt", "Item".created_at) <= $1',
'"Item"."deletedAt" IS NULL',
subClause(sub, 4, subClauseTable(type), me, showNsfw),
activeOrMine(me),
Expand Down