diff --git a/src/storage/db/model.ts b/src/storage/db/model.ts index f3c21278..625811ed 100644 --- a/src/storage/db/model.ts +++ b/src/storage/db/model.ts @@ -292,15 +292,15 @@ export interface EmoteUseTable extends AuditedTable { interface FightHistoryTable extends AuditedTable { id: GeneratedAlways; - userid: Snowflake; + userId: Snowflake; result: boolean; bossName: string; - firsttime: boolean; + firstTime: boolean; } interface FightInventoryTable { id: GeneratedAlways; - userid: Snowflake; + userId: Snowflake; lootId: LootId; equippedSlot: string; } diff --git a/src/storage/fightHistory.ts b/src/storage/fightHistory.ts index 2cf33c64..92815d24 100644 --- a/src/storage/fightHistory.ts +++ b/src/storage/fightHistory.ts @@ -7,10 +7,10 @@ export async function insertResult(userId: User["id"], boss: string, win: boolea return await ctx .insertInto("fightHistory") .values({ - userid: userId, + userId: userId, result: win, bossName: boss, - firsttime: lastWins.length === 0 && win, + firstTime: lastWins.length === 0 && win, }) .execute(); } @@ -18,7 +18,7 @@ export async function insertResult(userId: User["id"], boss: string, win: boolea export async function getWinsForBoss(userId: User["id"], boss: string, ctx = db()) { return await ctx .selectFrom("fightHistory") - .where("userid", "=", userId) + .where("userId", "=", userId) .where("bossName", "=", boss) .where("result", "=", true) .selectAll() @@ -28,7 +28,7 @@ export async function getWinsForBoss(userId: User["id"], boss: string, ctx = db( export async function getLastFight(userId: User["id"], ctx = db()) { return await ctx .selectFrom("fightHistory") - .where("userid", "=", userId) + .where("userId", "=", userId) .orderBy("createdAt desc") .selectAll() .executeTakeFirst(); diff --git a/src/storage/fightInventory.ts b/src/storage/fightInventory.ts index 4a3d082f..5585a0e8 100644 --- a/src/storage/fightInventory.ts +++ b/src/storage/fightInventory.ts @@ -10,7 +10,7 @@ import { deleteLoot } from "@/storage/loot.js"; export async function getFightInventoryUnsorted(userId: User["id"], ctx = db()) { return await ctx .selectFrom("fightInventory") - .where("userid", "=", userId) + .where("userId", "=", userId) .selectAll() .execute(); } @@ -41,7 +41,7 @@ export async function getGameTemplate( export async function getItemsByType(userId: User["id"], fightItemType: string, ctx = db()) { return await ctx .selectFrom("fightInventory") - .where("userid", "=", userId) + .where("userId", "=", userId) .where("equippedSlot", "=", fightItemType) .selectAll() .execute(); @@ -55,7 +55,7 @@ export async function removeItemsAfterFight(userId: User["id"], ctx = db()) { } await ctx .deleteFrom("fightInventory") - .where("userid", "=", userId) + .where("userId", "=", userId) .where("equippedSlot", "=", "item") .execute(); }); @@ -89,7 +89,7 @@ export async function equipItembyLoot( await ctx .insertInto("fightInventory") .values({ - userid: userId, + userId: userId, lootId: loot.id, equippedSlot: itemType, }) diff --git a/src/storage/migrations/11-fightsystem.ts b/src/storage/migrations/11-fightsystem.ts index 15c42761..d510fb5f 100644 --- a/src/storage/migrations/11-fightsystem.ts +++ b/src/storage/migrations/11-fightsystem.ts @@ -6,7 +6,7 @@ export async function up(db: Kysely) { .createTable("fightInventory") .ifNotExists() .addColumn("id", "integer", c => c.primaryKey().autoIncrement()) - .addColumn("userid", "text") + .addColumn("userId", "text") .addColumn("lootId", "integer", c => c.references("loot.id")) .addColumn("equippedSlot", "text") .execute(); @@ -15,10 +15,10 @@ export async function up(db: Kysely) { .createTable("fightHistory") .ifNotExists() .addColumn("id", "integer", c => c.primaryKey().autoIncrement()) - .addColumn("userid", "text", c => c.notNull()) + .addColumn("userId", "text", c => c.notNull()) .addColumn("bossName", "text", c => c.notNull()) .addColumn("result", "boolean", c => c.notNull()) - .addColumn("firsttime", "boolean", c => c.notNull()) + .addColumn("firstTime", "boolean", c => c.notNull()) .addColumn("createdAt", "timestamp", c => c.notNull().defaultTo(sql`current_timestamp`)) .addColumn("updatedAt", "timestamp", c => c.notNull().defaultTo(sql`current_timestamp`)) .execute();