mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2026-09-29 17:15:03 -07:00
47 lines
996 B
TypeScript
47 lines
996 B
TypeScript
import { Column, Entity, Index, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
|
|
|
|
import { ClientEntity } from '../client/client.entity';
|
|
import { TrackedEntity } from '../utils/TrackedEntity.entity';
|
|
|
|
@Entity()
|
|
//Index for statistics save
|
|
@Index(["clientId", "time"])
|
|
export class ClientStatisticsEntity extends TrackedEntity {
|
|
|
|
@PrimaryGeneratedColumn({type: 'bigint'})
|
|
id: number;
|
|
|
|
@Column({ length: 62, type: 'varchar' })
|
|
address: string;
|
|
|
|
@Column()
|
|
clientName: string;
|
|
|
|
@Column({ length: 8, type: 'varchar' })
|
|
sessionId: string;
|
|
|
|
@Index()
|
|
@Column({ type: 'bigint' })
|
|
time: number;
|
|
|
|
@Column({ type: 'decimal' })
|
|
shares: number;
|
|
|
|
@Column({ default: 0, type: 'bigint' })
|
|
acceptedCount: number;
|
|
|
|
|
|
|
|
@ManyToOne(
|
|
() => ClientEntity,
|
|
clientEntity => clientEntity.statistics,
|
|
{ nullable: false, }
|
|
)
|
|
client: ClientEntity;
|
|
|
|
@Index()
|
|
@Column({ name: 'clientId' })
|
|
public clientId: string;
|
|
|
|
|
|
} |