-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Define data schema for CSGO stats (#25)
- Loading branch information
1 parent
53ce1c8
commit 94056b5
Showing
22 changed files
with
1,292 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { | ||
BaseEntity, | ||
Column, | ||
CreateDateColumn, | ||
Entity, | ||
JoinColumn, | ||
ManyToOne, | ||
OneToOne, | ||
PrimaryGeneratedColumn | ||
} from 'typeorm'; | ||
import { BombStatusChange } from 'types/BombStatusChange.enum'; | ||
|
||
import { PlayerInfo } from './playerInfo.entity'; | ||
import { Position } from './position.entity'; | ||
import { Round } from './round.entity'; | ||
|
||
/** | ||
* Database record | ||
*/ | ||
@Entity() | ||
export class BombStatus extends BaseEntity { | ||
/** | ||
* Primary key | ||
*/ | ||
@PrimaryGeneratedColumn() | ||
id: number; | ||
|
||
@CreateDateColumn() | ||
createdAt: Date; | ||
|
||
@Column() | ||
tick: number; | ||
|
||
@Column({ | ||
type: "enum", | ||
enum: Object.values(BombStatusChange) | ||
}) | ||
type: BombStatusChange; | ||
|
||
@OneToOne(() => PlayerInfo) | ||
@JoinColumn() | ||
player: PlayerInfo; | ||
|
||
@OneToOne(() => Position) | ||
@JoinColumn() | ||
position: Position; | ||
|
||
@ManyToOne(() => Round) | ||
round: Round; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { | ||
BaseEntity, | ||
Column, | ||
CreateDateColumn, | ||
Entity, | ||
JoinColumn, | ||
ManyToOne, | ||
OneToOne, | ||
PrimaryGeneratedColumn | ||
} from 'typeorm'; | ||
|
||
import { PlayerInfo } from './playerInfo.entity'; | ||
import { Round } from './round.entity'; | ||
|
||
/** | ||
* Database record | ||
*/ | ||
@Entity() | ||
export class Kill extends BaseEntity { | ||
/** | ||
* Primary key | ||
*/ | ||
@PrimaryGeneratedColumn() | ||
id: number; | ||
|
||
@CreateDateColumn() | ||
createdAt: Date; | ||
|
||
@Column() | ||
tick: number; | ||
|
||
@Column() | ||
throughSmoke: boolean; | ||
|
||
@Column() | ||
whileBlind: boolean; | ||
|
||
@Column() | ||
throughWall: boolean; | ||
|
||
@OneToOne(() => PlayerInfo) | ||
@JoinColumn() | ||
attacker: PlayerInfo; | ||
|
||
@OneToOne(() => PlayerInfo) | ||
@JoinColumn() | ||
victim: PlayerInfo; | ||
|
||
@OneToOne(() => PlayerInfo, { nullable: true }) | ||
@JoinColumn() | ||
assister: PlayerInfo; | ||
|
||
@ManyToOne(() => Round) | ||
round: Round; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { | ||
BaseEntity, | ||
Column, | ||
CreateDateColumn, | ||
Entity, | ||
JoinColumn, | ||
ManyToOne, | ||
OneToOne, | ||
PrimaryGeneratedColumn | ||
} from 'typeorm'; | ||
|
||
import { PlayerInfo } from './playerInfo.entity'; | ||
import { Round } from './round.entity'; | ||
|
||
/** | ||
* Database record | ||
*/ | ||
@Entity() | ||
export class PlayerBlind extends BaseEntity { | ||
/** | ||
* Primary key | ||
*/ | ||
@PrimaryGeneratedColumn() | ||
id: number; | ||
|
||
@CreateDateColumn() | ||
createdAt: Date; | ||
|
||
@Column() | ||
tick: number; | ||
|
||
/** | ||
* How long a player was blinded, in ticks | ||
*/ | ||
@Column() | ||
duration: number; | ||
|
||
@OneToOne(() => PlayerInfo) | ||
@JoinColumn() | ||
attacker: PlayerInfo; | ||
|
||
@OneToOne(() => PlayerInfo) | ||
@JoinColumn() | ||
victim: PlayerInfo; | ||
|
||
@ManyToOne(() => Round) | ||
round: Round; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { | ||
BaseEntity, | ||
Column, | ||
CreateDateColumn, | ||
Entity, | ||
JoinColumn, | ||
ManyToOne, | ||
OneToOne, | ||
PrimaryGeneratedColumn | ||
} from 'typeorm'; | ||
import { HurtSources } from 'types/HurtSources.enum'; | ||
|
||
import { PlayerInfo } from './playerInfo.entity'; | ||
import { Round } from './round.entity'; | ||
|
||
/** | ||
* Database record | ||
*/ | ||
@Entity() | ||
export class PlayerHurt extends BaseEntity { | ||
/** | ||
* Primary key | ||
*/ | ||
@PrimaryGeneratedColumn() | ||
id: number; | ||
|
||
@CreateDateColumn() | ||
createdAt: Date; | ||
|
||
@Column() | ||
tick: number; | ||
|
||
@Column() | ||
damageArmour: number; | ||
|
||
@Column() | ||
damageHealth: number; | ||
|
||
// TODO: Should be an enum but cba checking what values are possible right now :) | ||
@Column() | ||
hitGroup: number; | ||
|
||
@Column() | ||
source: HurtSources; | ||
|
||
@OneToOne(() => PlayerInfo) | ||
@JoinColumn() | ||
attacker: PlayerInfo; | ||
|
||
@OneToOne(() => PlayerInfo) | ||
@JoinColumn() | ||
victim: PlayerInfo; | ||
|
||
@ManyToOne(() => Round) | ||
round: Round; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import { | ||
BaseEntity, | ||
Column, | ||
CreateDateColumn, | ||
Entity, | ||
JoinColumn, | ||
ManyToOne, | ||
OneToOne, | ||
PrimaryGeneratedColumn | ||
} from 'typeorm'; | ||
import { Weapon } from 'types/Weapon.enum'; | ||
|
||
import { Player } from './player.entity'; | ||
import { Position } from './position.entity'; | ||
|
||
/** | ||
* Database record | ||
*/ | ||
@Entity() | ||
export class PlayerInfo extends BaseEntity { | ||
/** | ||
* Primary key | ||
*/ | ||
@PrimaryGeneratedColumn() | ||
id: number; | ||
|
||
@CreateDateColumn() | ||
createdAt: Date; | ||
|
||
@Column() | ||
tick: number; | ||
|
||
@Column() | ||
equipmentValue: number; | ||
|
||
@Column() | ||
freezeTimeEndEquipmentValue: number; | ||
|
||
@Column() | ||
cashSpentInRound: number; | ||
|
||
@Column() | ||
hasC4: boolean; | ||
|
||
@Column() | ||
health: number; | ||
|
||
@Column() | ||
armour: number; | ||
|
||
@Column() | ||
isScoped: boolean; | ||
|
||
@Column({ | ||
type: "enum", | ||
enum: Object.values(Weapon) | ||
}) | ||
weapon: Weapon; | ||
|
||
@Column() | ||
bulletsInMagazine: number; | ||
|
||
@OneToOne(() => Position) | ||
@JoinColumn() | ||
position: Position; | ||
|
||
@ManyToOne(() => Player) | ||
player: Player; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { | ||
BaseEntity, | ||
Column, | ||
CreateDateColumn, | ||
Entity, | ||
JoinColumn, | ||
ManyToOne, | ||
OneToOne, | ||
PrimaryGeneratedColumn | ||
} from 'typeorm'; | ||
|
||
import { PlayerInfo } from './playerInfo.entity'; | ||
import { Round } from './round.entity'; | ||
|
||
/** | ||
* Database record | ||
*/ | ||
@Entity() | ||
export class PlayerJump extends BaseEntity { | ||
/** | ||
* Primary key | ||
*/ | ||
@PrimaryGeneratedColumn() | ||
id: number; | ||
|
||
@CreateDateColumn() | ||
createdAt: Date; | ||
|
||
@Column() | ||
tick: number; | ||
|
||
@OneToOne(() => PlayerInfo) | ||
@JoinColumn() | ||
player: PlayerInfo; | ||
|
||
@ManyToOne(() => Round) | ||
round: Round; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { BaseEntity, Column, CreateDateColumn, Entity, PrimaryGeneratedColumn } from 'typeorm'; | ||
|
||
/** | ||
* Database record | ||
*/ | ||
@Entity() | ||
export class Position extends BaseEntity { | ||
/** | ||
* Primary key | ||
*/ | ||
@PrimaryGeneratedColumn() | ||
id: number; | ||
|
||
@CreateDateColumn() | ||
createdAt: Date; | ||
|
||
@Column() | ||
x: number; | ||
|
||
@Column() | ||
y: number; | ||
|
||
@Column() | ||
z: number; | ||
} |
Oops, something went wrong.