This commit is contained in:
2026-06-24 14:10:53 +02:00
commit fdb3768d63
122 changed files with 13239 additions and 0 deletions
@@ -0,0 +1,15 @@
import orm from '@src/type-orm.source'
import DataLoader from 'dataloader'
export const createApplicationStatusLoader = () =>
new DataLoader<{ offerId: number, userId: number }, String | null>(async (keys) => {
const applications: { id: number, offerId: number, userId: number, status: string }[] = await orm.createQueryBuilder()
.select('*')
.from('offer_application', 'oa')
.orWhere(keys)
.execute()
return keys.map(key => {
const application = applications.find(a => a.offerId == key.offerId && a.userId == key.userId)
return application ? application.status : null
})
})