mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
exchange t for typeorm with db for db model.. it's more clear
This commit is contained in:
parent
1830b277f8
commit
1f99be5eec
@ -5,8 +5,8 @@ import { Resolver, Query, Ctx, Authorized } from 'type-graphql'
|
|||||||
import CONFIG from '../../config'
|
import CONFIG from '../../config'
|
||||||
import { Balance } from '../models/Balance'
|
import { Balance } from '../models/Balance'
|
||||||
import { apiGet } from '../../apis/HttpRequest'
|
import { apiGet } from '../../apis/HttpRequest'
|
||||||
import { User as tUser } from '../../typeorm/entity/User'
|
import { User as dbUser } from '../../typeorm/entity/User'
|
||||||
import { Balance as tBalance } from '../../typeorm/entity/Balance'
|
import { Balance as dbBalance } from '../../typeorm/entity/Balance'
|
||||||
import calculateDecay from '../../util/decay'
|
import calculateDecay from '../../util/decay'
|
||||||
import { roundFloorFrom4 } from '../../util/round'
|
import { roundFloorFrom4 } from '../../util/round'
|
||||||
|
|
||||||
@ -20,8 +20,8 @@ export class BalanceResolver {
|
|||||||
if (!result.success) throw new Error(result.data)
|
if (!result.success) throw new Error(result.data)
|
||||||
|
|
||||||
// load user and balance
|
// load user and balance
|
||||||
const userEntity = await tUser.findByPubkeyHex(result.data.user.public_hex)
|
const userEntity = await dbUser.findByPubkeyHex(result.data.user.public_hex)
|
||||||
const balanceEntity = await tBalance.findByUser(userEntity.id)
|
const balanceEntity = await dbBalance.findByUser(userEntity.id)
|
||||||
const now = new Date()
|
const now = new Date()
|
||||||
const balance = new Balance({
|
const balance = new Balance({
|
||||||
balance: roundFloorFrom4(balanceEntity.amount),
|
balance: roundFloorFrom4(balanceEntity.amount),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user