mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Balance by user cannot fail but returns undefined if not found
This commit is contained in:
parent
a4744dd588
commit
7a424c5e33
@ -4,8 +4,6 @@ import { Balance } from '../entity/Balance'
|
|||||||
@EntityRepository(Balance)
|
@EntityRepository(Balance)
|
||||||
export class BalanceRepository extends Repository<Balance> {
|
export class BalanceRepository extends Repository<Balance> {
|
||||||
findByUser(userId: number): Promise<Balance | undefined> {
|
findByUser(userId: number): Promise<Balance | undefined> {
|
||||||
return this.createQueryBuilder('balance')
|
return this.createQueryBuilder('balance').where('balance.userId = :userId', { userId }).getOne()
|
||||||
.where('balance.userId = :userId', { userId })
|
|
||||||
.getOneOrFail()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user