import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, ManyToOne, JoinColumn } from 'typeorm';
import { Member } from './Member';

@Entity('member_account_log')
export class MemberAccountLog {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({ name: 'member_id', type: 'int', default: 0 })
  member_id: number;

  @Column({ name: 'site_id', type: 'int', default: 0 })
  site_id: number;

  @Column({ name: 'account_type', type: 'varchar', length: 255, default: 'point' })
  account_type: string;

  @Column({ name: 'account_data', type: 'decimal', precision: 10, scale: 2, default: 0 })
  account_data: number;

  @Column({ name: 'account_sum', type: 'decimal', precision: 10, scale: 2, default: 0 })
  account_sum: number;

  @Column({ name: 'from_type', type: 'varchar', length: 255, default: '' })
  from_type: string;

  @Column({ name: 'related_id', type: 'varchar', length: 50, default: '' })
  related_id: string;

  @Column({ name: 'create_time', type: 'int', default: 0 })
  create_time: number;

  @Column({ name: 'memo', type: 'varchar', length: 255, default: '' })
  memo: string;

  // 关联关系
  @ManyToOne(() => Member, member => member.accountLogs)
  @JoinColumn({ name: 'member_id' })
  member: Member;
} 