From cbd853fb565db543511b5cc29b6824b63da437b4 Mon Sep 17 00:00:00 2001 From: legonzaur Date: Thu, 22 Jun 2023 18:15:56 +0200 Subject: [PATCH] add model --- src/db/model.ts | 179 +++++++++++++++++++++++++++++++++++------------- 1 file changed, 133 insertions(+), 46 deletions(-) diff --git a/src/db/model.ts b/src/db/model.ts index f54cfd4..be55072 100644 --- a/src/db/model.ts +++ b/src/db/model.ts @@ -1,47 +1,129 @@ import { type Generated } from 'kysely' +interface HostTable { + host_name: string + host_id: Generated + host_token: Generated +} + +interface ServerTable { + server_name: string + host_id: number +} + +interface MatchTable { + match_id: Generated + host_id: number + server_name: string + game_map: string + gamemode: string + air_accel: boolean +} + +interface PlayerTable { + weapon_id: string + weapon_name: string +} + +interface WeaponTable { + playername: string + player_id: number +} + +interface ModsOnWeaponTable { + mod_id: number + speedloader: boolean + extra_ammo: boolean + gunrunner: boolean + gun_ready: boolean + quickswap: boolean + tactikill: boolean + suppressor: boolean + ricochet: boolean + pro_screen: boolean +} + +interface TitanChassisTable { + titan_id: string + chassis_name: string +} + +interface LoadoutTable { + loadout_id: Generated + primary_weapon: string + secondary_weapon: string + anti_titan_weapon: string + primary_mod_id: number + secondary_mod_id: number + anti_titan_mod_id: number + ordnance: string + tactical: string + titan_weapon: string + pilot_passive_1: string + pilot_passive_2: string + titan_passive_1: string + titan_passive_2: string + titan_passive_3: string + titan_passive_4: string + titan_passive_5: string + titan_passive_6: string + titan_special: string + titan_anti_rodeo: string + titan_primary_mod: string + titan_id: string +} + export interface KillTable { - id: Generated - servername: string - host: number - killstat_version: string - match_id: string - game_mode: string - map: string - unix_time: Generated - game_time: number - player_count: number - attacker_name: string - attacker_id: string - attacker_current_weapon: string - attacker_current_weapon_mods: number - attacker_weapon_1: string - attacker_weapon_1_mods: number - attacker_weapon_2: string - attacker_weapon_2_mods: number - attacker_weapon_3: string - attacker_weapon_3_mods: number - attacker_offhand_weapon_1: string - attacker_offhand_weapon_1_mods: number - attacker_offhand_weapon_2: string - attacker_offhand_weapon_2_mods: number - victim_name: string - victim_id: string - victim_current_weapon: string - victim_current_weapon_mods: number - victim_weapon_1: string - victim_weapon_1_mods: number - victim_weapon_2: string - victim_weapon_2_mods: number - victim_weapon_3: string - victim_weapon_3_mods: string - victim_offhand_weapon_1: string - victim_offhand_weapon_1_mods: number - victim_offhand_weapon_2: string - victim_offhand_weapon_2_mods: number - cause_of_death: string + kill_id: Generated + attacker_id: bigint + victim_id: bigint + match_id: number + attacker_loadout_id: number + victim_loadout_id: number + attacker_speed: number + victim_speed: number + attacker_movementstate: string + victim_movementstate: string distance: number - titan?: string + unix_time: Date + game_time: number + cause_of_death: string + attacker_held_weapon: string + victim_held_weapon: string +} + +export interface TitanStatsInMatchTable { + match_id: number + player_id: bigint + titan_id: string + playtime: bigint + shots_fired: number + shots_hit: number + headshots: number +} + +export interface WeaponStatsInMatchTable { + match_id: number + player_id: bigint + weapon_id: string + playtime: bigint + shots_fired: number + shots_hit: number + headshots: number + ricochets: number +} + +export interface PlayerStatsInMatchTable { + match_id: number + player_id: bigint + shots_fired: number + shots_hit: number + headshots: number + ricochets: number + overall_distance_covered: bigint + time_grounded: bigint + time_wall: bigint + time_air: bigint } export interface KillViewTable { @@ -59,15 +141,20 @@ export interface KillViewTable { total_distance: number } -interface HosterTable { - id: Generated - name: string - token: Generated -} interface Database { kill_view: KillViewTable + host: HostTable + server: ServerTable + match: MatchTable + player: PlayerTable + weapon: WeaponTable + mods_on_weapon: ModsOnWeaponTable + titan_chassis: TitanChassisTable + loadout: LoadoutTable kill: KillTable - host: HosterTable + titan_stats_in_match: TitanStatsInMatchTable + weapon_stats_in_match: WeaponStatsInMatchTable + player_stats_in_match: PlayerStatsInMatchTable } export default Database