compilation not working

This commit is contained in:
2023-08-13 16:12:16 +00:00
parent 3a29c5cd88
commit 442b894217
5 changed files with 50 additions and 38 deletions
+1 -2
View File
@@ -1,10 +1,9 @@
{ {
"name": "ToneAPI_backend", "name": "Stat_Tracker_Server",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "ToneAPI_backend",
"dependencies": { "dependencies": {
"@types/ws": "^8.5.4", "@types/ws": "^8.5.4",
"cors": "^2.8.5", "cors": "^2.8.5",
+1 -1
Submodule src/db updated: dc5325c23a...cf5a2959cf
+2 -2
View File
@@ -86,7 +86,7 @@ type RequestBody<T> = Request<{}, {}, T>;
router.post( router.post(
"/kill", "/kill",
validateBody(typia.createValidate<KillData>()), // validateBody(typia.createValidate<KillData>()),
(req: RequestBody<KillData>, res: Response) => { (req: RequestBody<KillData>, res: Response) => {
void (async () => { void (async () => {
const host_id = res.locals.host_id; const host_id = res.locals.host_id;
@@ -190,7 +190,7 @@ router.post(
router.post( router.post(
"/match", "/match",
validateBody(typia.createValidate<MatchData>()), // validateBody(typia.createValidate<MatchData>()),
(req: RequestBody<MatchData>, res: Response) => { (req: RequestBody<MatchData>, res: Response) => {
void (async () => { void (async () => {
const host_id = res.locals.host_id; const host_id = res.locals.host_id;
+8 -8
View File
@@ -7,14 +7,14 @@ type WeaponKillData = {
}; };
export type LoadoutKillData = { export type LoadoutKillData = {
ordnance: WeaponKillData | null; ordnance: WeaponKillData | undefined;
secondary: WeaponKillData | null; secondary: WeaponKillData | undefined;
primary: WeaponKillData | null; primary: WeaponKillData | undefined;
tactical: WeaponKillData | null; tactical: WeaponKillData | undefined;
anti_titan: WeaponKillData | null; anti_titan: WeaponKillData | undefined;
passive1:string | null; passive1:string | undefined;
passive2:string | null; passive2:string | undefined;
titan: string | null; titan: string | undefined;
}; };
type PlayerKillData = { type PlayerKillData = {
+38 -25
View File
@@ -115,7 +115,7 @@ export async function checkOrCreateTitan(titan_id: string | null, trx?:Transacti
.execute(); .execute();
} }
} }
await createOrRunInTransaction(runner, trx) await createOrRunInTransaction(runner, trx)
} }
@@ -128,40 +128,53 @@ export async function checkOrCreateLoadout(loadoutData: LoadoutKillData) {
let loadout = await trx let loadout = await trx
.selectFrom("ToneAPI_v3.loadout") .selectFrom("ToneAPI_v3.loadout")
.select("ToneAPI_v3.loadout.loadout_id") .select("ToneAPI_v3.loadout.loadout_id")
.where("primary_weapon", "=", loadoutData.primary?.id ?? null) .$if(loadoutData.primary?.id !== undefined, (qb)=>qb.where("primary_weapon", "=", loadoutData.primary!.id))
.where("primary_mod_id", "=", loadoutData.primary?.mods ?? null) .$if(loadoutData.primary?.id == undefined, (qb)=>qb.where("primary_weapon", "is", null))
.where("secondary_weapon", "=", loadoutData.secondary?.id ?? null) .$if(loadoutData.primary?.mods !== undefined, (qb)=>qb.where("primary_mod_id", "=", loadoutData.primary!.mods))
.where("secondary_mod_id", "=", loadoutData.secondary?.mods ?? null) .$if(loadoutData.primary?.mods == undefined, (qb)=>qb.where("primary_mod_id", "is", null))
.where("anti_titan_weapon", "=", loadoutData.anti_titan?.id ?? null) .$if(loadoutData.secondary?.id !== undefined, (qb)=>qb.where("secondary_weapon", "=", loadoutData.secondary!.id))
.where("anti_titan_mod_id", "=", loadoutData.anti_titan?.mods ?? null) .$if(loadoutData.secondary?.id == undefined, (qb)=>qb.where("secondary_weapon", "is", null))
.where( .$if(loadoutData.secondary?.mods !== undefined, (qb)=>qb.where("secondary_mod_id", "=", loadoutData.secondary!.mods))
"ToneAPI_v3.loadout.ordnance", .$if(loadoutData.secondary?.mods == undefined, (qb)=>qb.where("secondary_mod_id", "is", null))
"=", .$if(loadoutData.anti_titan?.id !== undefined, (qb)=>qb.where("anti_titan_weapon", "=", loadoutData.anti_titan!.id))
loadoutData.ordnance?.id ?? null .$if(loadoutData.anti_titan?.id == undefined, (qb)=>qb.where("anti_titan_weapon", "is", null))
) .$if(loadoutData.anti_titan?.mods !== undefined, (qb)=>qb.where("anti_titan_mod_id", "=", loadoutData.anti_titan!.mods))
.where( .$if(loadoutData.anti_titan?.mods == undefined, (qb)=>qb.where("anti_titan_mod_id", "is", null))
"ToneAPI_v3.loadout.tactical",
"=", .$if(loadoutData.ordnance?.id !== undefined, (qb)=>qb.where("ordnance", "=", loadoutData.ordnance!.id))
loadoutData.tactical?.id ?? null .$if(loadoutData.ordnance?.id == undefined, (qb)=>qb.where("ordnance", "is", null))
)
.where("ToneAPI_v3.loadout.pilot_passive_1", "=", loadoutData.passive1) .$if(loadoutData.ordnance?.id !== undefined, (qb)=>qb.where("ordnance", "=", loadoutData.ordnance!.id))
.where("ToneAPI_v3.loadout.pilot_passive_2", "=", loadoutData.passive2) .$if(loadoutData.ordnance?.id == undefined, (qb)=>qb.where("ordnance", "is", null))
.where("ToneAPI_v3.loadout.titan_id", "=", loadoutData.titan)
.$if(loadoutData.tactical?.id !== undefined, (qb)=>qb.where("tactical", "=", loadoutData.tactical!.id))
.$if(loadoutData.tactical?.id == undefined, (qb)=>qb.where("tactical", "is", null))
.$if(loadoutData.passive1 !== undefined, (qb)=>qb.where("pilot_passive_1", "=", loadoutData.passive1!))
.$if(loadoutData.passive1 == undefined, (qb)=>qb.where("pilot_passive_1", "is", null))
.$if(loadoutData.passive2 !== undefined, (qb)=>qb.where("pilot_passive_2", "=", loadoutData.passive2!))
.$if(loadoutData.passive2 == undefined, (qb)=>qb.where("pilot_passive_2", "is", null))
.$if(loadoutData.titan !== undefined, (qb)=>qb.where("titan_id", "=", loadoutData.titan!))
.$if(loadoutData.titan == undefined, (qb)=>qb.where("titan_id", "is", null))
.executeTakeFirst(); .executeTakeFirst();
if (!loadout) { if (!loadout) {
if (loadoutData.primary !== null) { if (loadoutData.primary !== undefined) {
await checkOrCreateWeaponMods(loadoutData.primary, trx); await checkOrCreateWeaponMods(loadoutData.primary, trx);
} }
if (loadoutData.secondary !== null) { if (loadoutData.secondary !== undefined) {
await checkOrCreateWeaponMods(loadoutData.secondary, trx); await checkOrCreateWeaponMods(loadoutData.secondary, trx);
} }
if (loadoutData.anti_titan !== null) { if (loadoutData.anti_titan !== undefined) {
await checkOrCreateWeaponMods(loadoutData.anti_titan, trx); await checkOrCreateWeaponMods(loadoutData.anti_titan, trx);
} }
if (loadoutData.ordnance !== null) { if (loadoutData.ordnance !== undefined) {
await checkOrCreateWeapon(loadoutData.ordnance.id, trx); await checkOrCreateWeapon(loadoutData.ordnance.id, trx);
} }
await checkOrCreateTitan(loadoutData.titan, trx); if (loadoutData.titan !== undefined) {
await checkOrCreateTitan(loadoutData.titan, trx);
}
const result = await trx const result = await trx
.insertInto("ToneAPI_v3.loadout") .insertInto("ToneAPI_v3.loadout")
.values({ .values({