Fix typeorm issue

This commit is contained in:
Hongbo Wu 2022-11-11 14:53:46 +08:00
parent ac21e4e6c8
commit 477b5d7d24
2 changed files with 2 additions and 4 deletions

View file

@ -22,7 +22,7 @@ export class NewsletterEmail {
user!: User
@Column('varchar', { nullable: true })
confirmationCode?: string
confirmationCode?: string | null
@CreateDateColumn()
createdAt!: Date

View file

@ -106,9 +106,7 @@ const validateInvite = async (
return false
}
const membershipRepo = entityManager.getRepository(GroupMembership)
const numMembers = await membershipRepo.count({
where: { invite: invite },
})
const numMembers = await membershipRepo.countBy({ invite: { id: invite.id } })
if (numMembers >= invite.maxMembers) {
console.log('rejecting invite, too many users', invite, numMembers)
return false