mirror of
https://github.com/System-End/scraps.git
synced 2026-04-19 16:28:20 +00:00
push push push spsuh push psuh
This commit is contained in:
parent
b7c8eeba5d
commit
89ab8d4573
3 changed files with 9 additions and 12 deletions
|
|
@ -2,7 +2,7 @@
|
|||
"name": "app",
|
||||
"version": "1.0.50",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"test": "bun test",
|
||||
"dev": "bun run --watch src/index.ts",
|
||||
"start": "bun run src/index.ts"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
import 'dotenv/config'
|
||||
import { drizzle } from 'drizzle-orm/node-postgres'
|
||||
import { sql } from 'drizzle-orm'
|
||||
|
||||
const db = drizzle(process.env.DATABASE_URL!)
|
||||
|
||||
await db.execute(sql`DROP TABLE IF EXISTS projects CASCADE`)
|
||||
console.log('Dropped projects table')
|
||||
|
|
@ -953,12 +953,18 @@ shop.post('/items/:id/refinery/undo', async ({ params, headers }) => {
|
|||
|
||||
const order = orders[0]
|
||||
|
||||
// Delete the order (balance is calculated dynamically, so deleting this removes the cost from the spent total)
|
||||
await db
|
||||
.delete(refineryOrdersTable)
|
||||
.where(eq(refineryOrdersTable.id, order.id))
|
||||
|
||||
// Get updated boost and upgrade count
|
||||
await db
|
||||
.delete(refinerySpendingHistoryTable)
|
||||
.where(and(
|
||||
eq(refinerySpendingHistoryTable.userId, user.id),
|
||||
eq(refinerySpendingHistoryTable.shopItemId, itemId),
|
||||
eq(refinerySpendingHistoryTable.cost, order.cost)
|
||||
))
|
||||
|
||||
const boost = await db
|
||||
.select({
|
||||
boostPercent: sql<number>`COALESCE(SUM(${refineryOrdersTable.boostAmount}), 0)`,
|
||||
|
|
@ -974,7 +980,6 @@ shop.post('/items/:id/refinery/undo', async ({ params, headers }) => {
|
|||
const newUpgradeCount = boost.length > 0 ? Number(boost[0].upgradeCount) : 0
|
||||
const refundedCost = order.cost
|
||||
|
||||
// Get penalty for effective probability calculation
|
||||
const penalty = await db
|
||||
.select({ probabilityMultiplier: shopPenaltiesTable.probabilityMultiplier })
|
||||
.from(shopPenaltiesTable)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue