mirror of
https://github.com/ReCloudStudio/WebHooker.git
synced 2026-09-22 16:11:29 +00:00
chore: auto-fix lint & formatting [skip ci]
This commit is contained in:
parent
df0edbb581
commit
3bcc98efc8
9 changed files with 152 additions and 77 deletions
|
|
@ -159,7 +159,9 @@ export async function getFailedSendLog(
|
|||
`SELECT ${COLUMNS} FROM send_logs WHERE ok = 0 AND group_id = ? ORDER BY ts DESC LIMIT ?`,
|
||||
)
|
||||
.bind(groupId, limit)
|
||||
: db.prepare(`SELECT ${COLUMNS} FROM send_logs WHERE ok = 0 ORDER BY ts DESC LIMIT ?`).bind(limit);
|
||||
: db
|
||||
.prepare(`SELECT ${COLUMNS} FROM send_logs WHERE ok = 0 ORDER BY ts DESC LIMIT ?`)
|
||||
.bind(limit);
|
||||
const { results } = await stmt.all<LogRow>();
|
||||
return results.map(toRecord);
|
||||
} catch (err) {
|
||||
|
|
|
|||
|
|
@ -54,7 +54,10 @@ const EMPTY: DeliveryMetrics = {
|
|||
recentFailures: [],
|
||||
};
|
||||
|
||||
export async function getDeliveryMetrics(db: D1Database, groupId?: string): Promise<DeliveryMetrics> {
|
||||
export async function getDeliveryMetrics(
|
||||
db: D1Database,
|
||||
groupId?: string,
|
||||
): Promise<DeliveryMetrics> {
|
||||
const where = groupId ? " WHERE group_id = ?" : "";
|
||||
const and = groupId ? " AND group_id = ?" : "";
|
||||
const bindGroup = (stmt: D1PreparedStatement): D1PreparedStatement =>
|
||||
|
|
@ -86,7 +89,9 @@ export async function getDeliveryMetrics(db: D1Database, groupId?: string): Prom
|
|||
),
|
||||
).all<StatusRow>();
|
||||
const duration = await bindGroup(
|
||||
db.prepare(`SELECT AVG(duration_ms) AS avg FROM send_logs WHERE duration_ms IS NOT NULL${and}`),
|
||||
db.prepare(
|
||||
`SELECT AVG(duration_ms) AS avg FROM send_logs WHERE duration_ms IS NOT NULL${and}`,
|
||||
),
|
||||
).all<AvgRow>();
|
||||
const attempts = await bindGroup(
|
||||
db.prepare(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue