user module
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { Entity, Property, ManyToOne, Index, Enum } from '@mikro-orm/core';
|
||||
import { BaseEntity } from '../../../common/entities/base.entity';
|
||||
import { User } from './user.entity';
|
||||
import { CreditTransactionType } from '../interface/credit';
|
||||
|
||||
@Entity({ tableName: 'credit_transactions' })
|
||||
@Index({ properties: ['user'] })
|
||||
export class CreditTransaction extends BaseEntity {
|
||||
@ManyToOne(() => User)
|
||||
user!: User;
|
||||
|
||||
@Property()
|
||||
orderId: string
|
||||
|
||||
@Property({ type: 'decimal', precision: 10, scale: 0 })
|
||||
amount!: number;
|
||||
|
||||
@Property({ type: 'decimal', precision: 10, scale: 0 })
|
||||
balance!: number;
|
||||
|
||||
@Enum(() => CreditTransaction)
|
||||
type!: CreditTransactionType;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user