stacker.news/worker/auction.js
keyan 9f79ff1f89 Revert "Merge serializeInvoiceable with serialize (#1040)"
This reverts commit e7e7cbff0a54155a6cf059afe229d0456a3d6a93.
2024-04-08 15:50:39 -05:00

24 lines
504 B
JavaScript

import serialize from '@/api/resolvers/serial.js'
export async function auction ({ models }) {
// get all items we need to check
const items = await models.item.findMany(
{
where: {
maxBid: {
not: null
},
status: {
not: 'STOPPED'
}
}
}
)
// for each item, run serialized auction function
items.forEach(async item => {
await serialize(models,
models.$executeRaw`SELECT run_auction(${item.id}::INTEGER)`)
})
}