Skip to content

Commit fe655b7

Browse files
chore: generate
1 parent 05f335c commit fe655b7

4 files changed

Lines changed: 32 additions & 28 deletions

File tree

‎packages/console/app/src/routes/api/support/actions/create-referral.ts‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,5 @@ export async function POST(event: APIEvent) {
2020
}
2121
return Referral.create(body.data)
2222
.then((result) => Response.json({ success: true, message: "Referral created", result }))
23-
.catch((error) =>
24-
Response.json({ error: error instanceof Error ? error.message : String(error) }, { status: 400 }),
25-
)
23+
.catch((error) => Response.json({ error: error instanceof Error ? error.message : String(error) }, { status: 400 }))
2624
}

‎packages/console/app/src/routes/api/support/actions/delete-account.ts‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,5 @@ export async function DELETE(event: APIEvent) {
1717
}
1818
return Account.remove(body.data.email)
1919
.then(() => Response.json({ success: true, message: "Account deleted" }))
20-
.catch((error) =>
21-
Response.json({ error: error instanceof Error ? error.message : String(error) }, { status: 400 }),
22-
)
20+
.catch((error) => Response.json({ error: error instanceof Error ? error.message : String(error) }, { status: 400 }))
2321
}

‎packages/console/core/src/account.ts‎

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,25 +38,35 @@ export namespace Account {
3838
.select({ email: AuthTable.subject })
3939
.from(AuthTable)
4040
.where(and(eq(AuthTable.accountID, account.id), eq(AuthTable.provider, "email")))
41-
const users = await tx
42-
.select({ id: UserTable.id })
43-
.from(UserTable)
44-
.where(eq(UserTable.accountID, account.id))
41+
const users = await tx.select({ id: UserTable.id }).from(UserTable).where(eq(UserTable.accountID, account.id))
4542
if (users.length > 0) {
4643
await tx
4744
.update(KeyTable)
4845
.set({ timeDeleted: sql`now()` })
49-
.where(inArray(KeyTable.userID, users.map((user) => user.id)))
46+
.where(
47+
inArray(
48+
KeyTable.userID,
49+
users.map((user) => user.id),
50+
),
51+
)
5052
}
5153
await tx
5254
.update(UserTable)
5355
.set({ accountID: null, email: null, name: "", timeDeleted: sql`now()` })
5456
.where(eq(UserTable.accountID, account.id))
5557
if (emails.length > 0) {
56-
await tx.delete(CouponTable).where(inArray(CouponTable.email, emails.map((row) => row.email)))
58+
await tx.delete(CouponTable).where(
59+
inArray(
60+
CouponTable.email,
61+
emails.map((row) => row.email),
62+
),
63+
)
5764
}
5865
await tx.delete(AuthTable).where(eq(AuthTable.accountID, account.id))
59-
await tx.update(AccountTable).set({ timeDeleted: sql`now()` }).where(eq(AccountTable.id, account.id))
66+
await tx
67+
.update(AccountTable)
68+
.set({ timeDeleted: sql`now()` })
69+
.where(eq(AccountTable.id, account.id))
6070
})
6171
})
6272

‎packages/enterprise/src/routes/api/[...path].ts‎

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -139,22 +139,20 @@ app
139139
return c.json({})
140140
},
141141
)
142-
.post(
143-
"/support/actions/remove-share",
144-
async (c) => {
145-
const authorization = c.req.header("authorization")
146-
const expected = `Bearer ${(Resource as unknown as Record<string, { value: string }>).SUPPORT_API_KEY.value}`
147-
const actual = Buffer.from(authorization ?? "")
148-
const secret = Buffer.from(expected)
149-
if (actual.length !== secret.length || !timingSafeEqual(actual, secret)) return c.json({ error: "Unauthorized" }, 401)
142+
.post("/support/actions/remove-share", async (c) => {
143+
const authorization = c.req.header("authorization")
144+
const expected = `Bearer ${(Resource as unknown as Record<string, { value: string }>).SUPPORT_API_KEY.value}`
145+
const actual = Buffer.from(authorization ?? "")
146+
const secret = Buffer.from(expected)
147+
if (actual.length !== secret.length || !timingSafeEqual(actual, secret))
148+
return c.json({ error: "Unauthorized" }, 401)
150149

151-
const body = z.object({ shareID: z.string().min(1) }).safeParse(await c.req.json().catch(() => undefined))
152-
if (!body.success) return c.json({ error: "Invalid request", issues: body.error.issues }, 400)
153-
return Share.removeAdmin({ id: body.data.shareID })
154-
.then(() => c.json({ success: true, message: "Share removed" }))
155-
.catch((error) => c.json({ error: error instanceof Error ? error.message : String(error) }, 400))
156-
},
157-
)
150+
const body = z.object({ shareID: z.string().min(1) }).safeParse(await c.req.json().catch(() => undefined))
151+
if (!body.success) return c.json({ error: "Invalid request", issues: body.error.issues }, 400)
152+
return Share.removeAdmin({ id: body.data.shareID })
153+
.then(() => c.json({ success: true, message: "Share removed" }))
154+
.catch((error) => c.json({ error: error instanceof Error ? error.message : String(error) }, 400))
155+
})
158156

159157
export function GET(event: APIEvent) {
160158
return app.fetch(event.request)

0 commit comments

Comments
 (0)