export async function healParty(userId: string) {
// Array of the user's party
const partyBeasts = await getBeastParty(userId);
const beastIds = partyBeasts.map((beast) => beast.id);
await db
.updateTable("beast")
.set((eb) => ({
currentHp: eb
.case()
.when("partyIndex", "=", 0)
.then(partyBeasts.find((b) => b.partyIndex === 0)?.stats.maxHp)
.when("partyIndex", "=", 1)
.then(partyBeasts.find((b) => b.partyIndex === 1)?.stats.maxHp)
.when("partyIndex", "=", 2)
.then(partyBeasts.find((b) => b.partyIndex === 2)?.stats.maxHp)
.when("partyIndex", "=", 3)
.then(partyBeasts.find((b) => b.partyIndex === 3)?.stats.maxHp)
.when("partyIndex", "=", 4)
.then(partyBeasts.find((b) => b.partyIndex === 4)?.stats.maxHp)
.when("partyIndex", "=", 5)
.then(partyBeasts.find((b) => b.partyIndex === 5)?.stats.maxHp)
.else(0)
.end(),
}))
.where("userId", "=", userId)
.where("id", "in", beastIds)
.execute();
}