mirror of
https://github.com/Elysola/WebHooker.git
synced 2026-11-20 17:13:49 +00:00
chore: auto-fix lint & formatting [skip ci]
This commit is contained in:
1 parent
df0edbb581
commit
3bcc98efc8
9 files changed
+152
-77
No files matched your search
@@ -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(
|
||||
|
||||
Reference in new issue
Block a user