Skip to content

Commit

Permalink
Fix var casing
Browse files Browse the repository at this point in the history
  • Loading branch information
holzmaster committed Jan 23, 2025
1 parent 4fcc8ef commit 853ce6a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions src/storage/db/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,15 +292,15 @@ export interface EmoteUseTable extends AuditedTable {

interface FightHistoryTable extends AuditedTable {
id: GeneratedAlways<number>;
userid: Snowflake;
userId: Snowflake;
result: boolean;
bossName: string;
firsttime: boolean;
firstTime: boolean;
}

interface FightInventoryTable {
id: GeneratedAlways<number>;
userid: Snowflake;
userId: Snowflake;
lootId: LootId;
equippedSlot: string;
}
8 changes: 4 additions & 4 deletions src/storage/fightHistory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ 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();
}

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()
Expand All @@ -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();
Expand Down
8 changes: 4 additions & 4 deletions src/storage/fightInventory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -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();
Expand All @@ -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();
});
Expand Down Expand Up @@ -89,7 +89,7 @@ export async function equipItembyLoot(
await ctx
.insertInto("fightInventory")
.values({
userid: userId,
userId: userId,
lootId: loot.id,
equippedSlot: itemType,
})
Expand Down
6 changes: 3 additions & 3 deletions src/storage/migrations/11-fightsystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export async function up(db: Kysely<any>) {
.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();
Expand All @@ -15,10 +15,10 @@ export async function up(db: Kysely<any>) {
.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();
Expand Down

0 comments on commit 853ce6a

Please sign in to comment.