36 lines
1.0 KiB
TypeScript
36 lines
1.0 KiB
TypeScript
import { Column, CreateDateColumn, Entity, Index, PrimaryGeneratedColumn } from 'typeorm';
|
|
|
|
@Entity('wallet_transactions')
|
|
@Index(['studentId', 'createdAt'])
|
|
export class WalletTransaction {
|
|
@PrimaryGeneratedColumn()
|
|
id: number;
|
|
|
|
@Column({ name: 'student_id', type: 'integer' })
|
|
studentId: number;
|
|
|
|
@Column({ name: 'bill_id', type: 'integer', nullable: true })
|
|
billId: number | null;
|
|
|
|
@Column({ name: 'operation_id', type: 'varchar', length: 64, nullable: true })
|
|
operationId: string | null;
|
|
|
|
@Column({ type: 'varchar', length: 30 })
|
|
type: 'recharge' | 'adjustment' | 'bill_payment' | 'bill_refund';
|
|
|
|
@Column({ type: 'decimal', precision: 12, scale: 2 })
|
|
amount: number;
|
|
|
|
@Column({ name: 'balance_after', type: 'decimal', precision: 12, scale: 2 })
|
|
balanceAfter: number;
|
|
|
|
@Column({ type: 'varchar', length: 300, nullable: true })
|
|
description: string | null;
|
|
|
|
@Column({ name: 'recorded_by', type: 'integer', nullable: true })
|
|
recordedBy: number | null;
|
|
|
|
@CreateDateColumn({ name: 'created_at' })
|
|
createdAt: Date;
|
|
}
|