Remove unnecessary avatar check during image fees calculation
This commit is contained in:
parent
e7175fbe87
commit
1af6a5c98d
@ -1184,17 +1184,13 @@ async function imageFees (text, { models, me }) {
|
|||||||
return [queries(ANON_USER_ID, unpaidS3Keys, fees), fees]
|
return [queries(ANON_USER_ID, unpaidS3Keys, fees), fees]
|
||||||
}
|
}
|
||||||
|
|
||||||
// we want to ignore avatars during fee calculation
|
// check how much stacker uploaded in last 24 hours
|
||||||
const { photoId } = await models.user.findUnique({ where: { id: me.id } })
|
|
||||||
|
|
||||||
// check how much stacker uploaded in last 24 hours (excluding avatar)
|
|
||||||
const { _sum: { size: size24h } } = await models.upload.aggregate({
|
const { _sum: { size: size24h } } = await models.upload.aggregate({
|
||||||
_sum: { size: true },
|
_sum: { size: true },
|
||||||
where: {
|
where: {
|
||||||
userId: me.id,
|
userId: me.id,
|
||||||
createdAt: { gt: datePivot(new Date(), { days: -1 }) },
|
createdAt: { gt: datePivot(new Date(), { days: -1 }) },
|
||||||
paid: true,
|
paid: true
|
||||||
id: photoId ? { not: photoId } : undefined
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user