Refactor hasElopageBuys method to a utility method.

This commit is contained in:
ogerly 2022-02-07 10:34:54 +01:00 committed by elweyn
parent 89af81b16c
commit 9d79e35f36

View File

@ -0,0 +1,9 @@
import { getCustomRepository } from '@dbTools/typeorm'
import { LoginElopageBuysRepository } from '../typeorm/repository/LoginElopageBuys'
export async function hasElopageBuys(email: string): Promise<boolean> {
const loginElopageBuysRepository = getCustomRepository(LoginElopageBuysRepository)
const elopageBuyCount = await loginElopageBuysRepository.count({ payerEmail: email })
return elopageBuyCount > 0
}