mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2026-09-29 17:15:03 -07:00
db refactor
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
import { Column, Entity, Index, PrimaryGeneratedColumn } from 'typeorm';
|
||||
import { Column, Entity, Index, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
|
||||
|
||||
import { ClientEntity } from '../client/client.entity';
|
||||
import { TrackedEntity } from '../utils/TrackedEntity.entity';
|
||||
|
||||
@Entity()
|
||||
//Index for getHashRateForSession
|
||||
@Index(["address", "clientName", "sessionId"])
|
||||
//Index for statistics save
|
||||
@Index(["address", "clientName", "sessionId", "time"])
|
||||
@Index(["clientId", "time"])
|
||||
export class ClientStatisticsEntity extends TrackedEntity {
|
||||
|
||||
@PrimaryGeneratedColumn()
|
||||
@@ -32,4 +31,17 @@ export class ClientStatisticsEntity extends TrackedEntity {
|
||||
acceptedCount: number;
|
||||
|
||||
|
||||
|
||||
@ManyToOne(
|
||||
() => ClientEntity,
|
||||
clientEntity => clientEntity.statistics,
|
||||
{ nullable: false, }
|
||||
)
|
||||
client: ClientEntity;
|
||||
|
||||
@Index()
|
||||
@Column({ name: 'clientId' })
|
||||
public clientId: string;
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user