import { BigNumber } from 'bignumber.js'
import { DecimalTransformer } from '../../transformers/decimal.transformer'
import { Column, CreateDateColumn, Entity, PrimaryGeneratedColumn } from 'typeorm'

@Entity()
export class CommissionRecord {
    @PrimaryGeneratedColumn()
    id: number

    @Column()
    userId: number

    @Column()
    fromUserId: number

    fromUser: any

    @Column()
    level: number

    @Column({ type: 'decimal', precision: 19, scale: 6, transformer: new DecimalTransformer() })
    ratio: BigNumber

    @Column({ type: 'decimal', precision: 19, scale: 2, transformer: new DecimalTransformer() })
    amount: BigNumber

    @CreateDateColumn()
    createdAt: Date

    constructor(data: Partial<CommissionRecord>) {
        Object.assign(this, data)
    }
    
}
